@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class ConduitGetCapabilitiesConduitAPIMethod extends ConduitAPIMethod {
4
5 public function getAPIMethodName() {
6 return 'conduit.getcapabilities';
7 }
8
9 public function shouldRequireAuthentication() {
10 return false;
11 }
12
13 public function getMethodDescription() {
14 return pht(
15 'List capabilities, wire formats, and authentication protocols '.
16 'available on this server.');
17 }
18
19 protected function defineParamTypes() {
20 return array();
21 }
22
23 protected function defineReturnType() {
24 return 'dict<string, any>';
25 }
26
27 public function getRequiredScope() {
28 return self::SCOPE_ALWAYS;
29 }
30
31 protected function execute(ConduitAPIRequest $request) {
32 $authentication = array(
33 'token',
34 'asymmetric',
35 'session',
36 'sessionless',
37 );
38
39 $oauth_class = PhabricatorOAuthServerApplication::class;
40 if (PhabricatorApplication::isClassInstalled($oauth_class)) {
41 $authentication[] = 'oauth';
42 }
43
44 return array(
45 'authentication' => $authentication,
46 'signatures' => array(
47 'consign',
48 ),
49 'input' => array(
50 'json',
51 'urlencoded',
52 ),
53 'output' => array(
54 'json',
55 'human',
56 ),
57 );
58 }
59
60}