rybak / copy-commit-reference-userscript

Userscripts to add a "Copy commit reference" button to commit pages of Git hosting providers.
https://greasyfork.org/en/scripts?set=588773
GNU Affero General Public License v3.0
2 stars 0 forks source link

Add support for Phorge #12

Closed rybak closed 1 month ago

rybak commented 1 year ago

Overview

https://we.phorge.it/source/phorge/repository/master/

Phorge is a collection of web applications which help software companies build better software.

Phorge is a community-maintained fork of Phabricator. ... Phorge is developed and maintained by The Phorge Team.

Is UI of this hosting provider a SPA?

No.

Commit URL structure

Phorge has two kinds of URLs – for repositories with "call signs" and for regular repositories. See PhabricatorDiffusionApplication.php for details. Relevant snippets:

  public function getMonograms() {
    // This is a special case, as r and R mean different things.
    return array('r', 'R');
  }
  public function getRoutes() {
    $repository_routes = array(
      '/' => array(
[...]
        'commit/(?P<commit>[a-z0-9]+)' => array(
          '/?' => 'DiffusionCommitController',
          '/branches/' => 'DiffusionCommitBranchesController',
          '/tags/' => 'DiffusionCommitTagsController',
        ),
[...]
      ),
[...]
      // NOTE: This must come after the rules above; it just gives us a
      // catch-all for serving repositories over HTTP. We must accept requests
      // without the trailing "/" because SVN commands don't necessarily
      // include it.
      '(?:/.*)?' => 'DiffusionRepositoryDefaultController',
    );

    return array(
      '/(?:'.
        'r(?P<repositoryCallsign>[A-Z]+)'.
        '|'.
        'R(?P<repositoryID>[1-9]\d*):'.
      ')(?P<commit>[a-f0-9]+)'
        => 'DiffusionCommitController',

      '/source/(?P<repositoryShortName>[^/]+)'
        => $repository_routes,
[...]
    );
  }

Public instances

Example URLs for testing

Screenshot

The userscript's button would fit well in the right hand sidebar:

image