Collection of themes/skins for the Fossil SCM

โŒˆโŒ‹ โŽ‡ branch:  Fossil Skins Extra


Check-in [0e67fdb36b]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:support for #access: flag
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0e67fdb36b7a460bf97d061f757f3a0bc53a9b7f
User & Date: mario 2021-10-20 05:59:00
Context
2021-10-20
21:12
Add experimental hooks admin (not useful yet) check-in: 8d85a3869b user: mario tags: trunk
05:59
support for #access: flag check-in: 0e67fdb36b user: mario tags: trunk
05:58
restructure form field output check-in: 3fd7f87ed2 user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to extroot/auth.

8
9
10
11
12
13
14

15
16
17
18
19
20
21
# description: Verifies a remote user id (URL) against active fossil login
# version: 0.6
# state: beta
# depends: php:curl, php:sqlite
# doc: https://www.w3.org/TR/indieauth/#authentication,
#     https://indieweb.org/authorization-endpoint
# config: -

#
# Minimal implementation of IndieAuth login endpoint. Runs as fossil cgi
# extension to verify currently logged in user. Confirms IndieAuth/OAuth
# request, and keeps login tokens in `fx_auth` table.
#
# This might progress into a /token endpoint, ideally enabling /micropub
# for the ticket system later on. Which is why the fx_auth/token table







>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# description: Verifies a remote user id (URL) against active fossil login
# version: 0.6
# state: beta
# depends: php:curl, php:sqlite
# doc: https://www.w3.org/TR/indieauth/#authentication,
#     https://indieweb.org/authorization-endpoint
# config: -
# access: auth
#
# Minimal implementation of IndieAuth login endpoint. Runs as fossil cgi
# extension to verify currently logged in user. Confirms IndieAuth/OAuth
# request, and keeps login tokens in `fx_auth` table.
#
# This might progress into a /token endpoint, ideally enabling /micropub
# for the ticket system later on. Which is why the fx_auth/token table

Changes to extroot/cat.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: output
# category: access
# title: Cat file
# description: Look up filename and redirect to /raw/UUID
# version: 0.1
# state: beta
# depends: php:sqlite
# config: -

#
# Does an indirect lookup by filename,
# then redirects to the /raw/UUID download.
#
# e.g.
#    http://fossil/ext/raw/README.md
#












>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: output
# category: access
# title: Cat file
# description: Look up filename and redirect to /raw/UUID
# version: 0.1
# state: beta
# depends: php:sqlite
# config: -
# access: public
#
# Does an indirect lookup by filename,
# then redirects to the /raw/UUID download.
#
# e.g.
#    http://fossil/ext/raw/README.md
#

Changes to extroot/changelog.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: output
# category: vcs
# title: changelog
# description: Outputs a NEWS-style timeline
# version: 0.2
# state: beta
# depends: php:sqlite
# config: -

#
# A variant of the hooks.th1 version, in PHP.
#


#ini_set("display_errors", 1);
include("./fossil_common.php");












>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: output
# category: vcs
# title: changelog
# description: Outputs a NEWS-style timeline
# version: 0.2
# state: beta
# depends: php:sqlite
# config: -
# access: public
#
# A variant of the hooks.th1 version, in PHP.
#


#ini_set("display_errors", 1);
include("./fossil_common.php");

Changes to extroot/crashreport.

1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: api
# category: tickets
# title: Crashreport
# description: Receives errors (JSON POST) and files them as tickets
# version: 0.1
# state: alpha
# config: -

#
# Creates a ticket for any POST it receives that contains valid JSON.
# Unpacks some fields into ticket properties, and posts the whole blob
# as ticket comment. This is probably more suitable for GUI apps than
# smaller console tools or librarikes.
# And it could probably also be reused for storing feature requests.
#











>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: api
# category: tickets
# title: Crashreport
# description: Receives errors (JSON POST) and files them as tickets
# version: 0.1
# state: alpha
# config: -
# access: public
#
# Creates a ticket for any POST it receives that contains valid JSON.
# Unpacks some fields into ticket properties, and posts the whole blob
# as ticket comment. This is probably more suitable for GUI apps than
# smaller console tools or librarikes.
# And it could probably also be reused for storing feature requests.
#

Changes to extroot/fossil_common.php.

102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
 */
function meta($fn) {
    $src = file_get_contents($fn, false, NULL, 0, 4096);
    $src = preg_replace("~^#!.+|\R~", "\n", $src);   # clean CRLF / shebang
    preg_match_all("~(^\h{0,4}(#|//|/?\*).*\n)+~m", $src, $uu);  # get comments (โš  not consecutive)
    $src = preg_replace("~^\h{0,4}(#|//|/?\*)\h{0,3}\r*~m", "", implode("", $uu[0]));  # strip any #// prefix
    preg_match_all("~^([\w-]+):(.*$\\n(?:(?![\w-]+:).+$\\n)*)~m", $src, $uu);  # extract fields (multiline)
    $r = array_combine($uu[1], $uu[2]);
    array_change_key_case($r); # โš  still unmapped hyphens
    if (count($doc = preg_split("~\R\h*\R~", trim($src), 2)) == 2) { ;  # comment block
        $r["__doc__"] = $doc[1];
    }
    return $r;
}








|







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
 */
function meta($fn) {
    $src = file_get_contents($fn, false, NULL, 0, 4096);
    $src = preg_replace("~^#!.+|\R~", "\n", $src);   # clean CRLF / shebang
    preg_match_all("~(^\h{0,4}(#|//|/?\*).*\n)+~m", $src, $uu);  # get comments (โš  not consecutive)
    $src = preg_replace("~^\h{0,4}(#|//|/?\*)\h{0,3}\r*~m", "", implode("", $uu[0]));  # strip any #// prefix
    preg_match_all("~^([\w-]+):(.*$\\n(?:(?![\w-]+:).+$\\n)*)~m", $src, $uu);  # extract fields (multiline)
    $r = array_combine($uu[1], array_map("trim", $uu[2]));
    array_change_key_case($r); # โš  still unmapped hyphens
    if (count($doc = preg_split("~\R\h*\R~", trim($src), 2)) == 2) { ;  # comment block
        $r["__doc__"] = $doc[1];
    }
    return $r;
}

Changes to extroot/index.

1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: display
# category: list
# title: Ext/ index
# description: Lists all CGI extensions in the extroot: folder
# version: 0.3
# state: stable
# config: -

#
# Just a glob() and some crude plugin meta extraction.
#

include("./fossil_common.php");
error_reporting(0);












>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: display
# category: list
# title: Ext/ index
# description: Lists all CGI extensions in the extroot: folder
# version: 0.3
# state: stable
# config: -
# access: public
#
# Just a glob() and some crude plugin meta extraction.
#

include("./fossil_common.php");
error_reporting(0);

43
44
45
46
47
48
49







50
51
52
53
54
55
56
 .fsl-ext .version {
    background: #542;
    color: black;
    padding: 2pt 10pt;
    margin-left: 4pt;
    border-radius: 4pt;
 }







 .fsl-ext .right {
    break: both;
    float: right;
    display: block;
    position: relative;
    right: -15pt;
 }







>
>
>
>
>
>
>







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
 .fsl-ext .version {
    background: #542;
    color: black;
    padding: 2pt 10pt;
    margin-left: 4pt;
    border-radius: 4pt;
 }
 .fsl-ext .access {
    background: #232;
    color: yellow;
    padding: 1pt 4pt;
    margin-left: 4pt;
    border-radius: 2pt;
 }
 .fsl-ext .right {
    break: both;
    float: right;
    display: block;
    position: relative;
    right: -15pt;
 }
80
81
82
83
84
85
86

87
88
89
90
91
92
93
94




95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
    }
    return $ls;
}


#-- run
page_md("<div class=extensions-index>\n");

foreach (ls(__DIR__) as $fn) {
    $meta = meta($fn);
    $h = "h";
    $title = $meta["title"] ?: $fn;
    $version = $meta["version"] ?: "-";
    $desc = $meta["description"] ?: $fn;
    $type = $meta["type"] ?: "extension";
    $cat = $meta["category"] ?: "-";




    print <<<EOF

    <div class="fsl-ext $cat" title="{$h($meta['__doc__'], ENT_QUOTES)}">
        <a href="$_SERVER[FOSSIL_URI]/ext/$fn">$title</a>
        <span class=version>$version</span>
        <span class=right>
          <div class=type>$type</div>
          <div class=category>$cat</div>
        </span>
        <div class=description>{$h($desc)}</div>
    </div>

EOF;
}
    print "</div>";

?>







>








>
>
>
>




|












88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
    }
    return $ls;
}


#-- run
page_md("<div class=extensions-index>\n");
$map_access = ["public"=>"๐Ÿ”Ž", "private"=>"๐Ÿ•ต", "admin"=>"๐Ÿ”‘", "auth"=>"๐Ÿ’"];
foreach (ls(__DIR__) as $fn) {
    $meta = meta($fn);
    $h = "h";
    $title = $meta["title"] ?: $fn;
    $version = $meta["version"] ?: "-";
    $desc = $meta["description"] ?: $fn;
    $type = $meta["type"] ?: "extension";
    $cat = $meta["category"] ?: "-";
    $access = "";
    if (!empty($meta["access"])) {
        $access = "<span class=access title='$meta[access]'>" . ($map_access[$meta["access"]] ?: "๐Ÿ”’") . "</span>";
    }
    print <<<EOF

    <div class="fsl-ext $cat" title="{$h($meta['__doc__'], ENT_QUOTES)}">
        <a href="$_SERVER[FOSSIL_URI]/ext/$fn">$title</a>
        <span class=version>$version</span> $access
        <span class=right>
          <div class=type>$type</div>
          <div class=category>$cat</div>
        </span>
        <div class=description>{$h($desc)}</div>
    </div>

EOF;
}
    print "</div>";

?>

Changes to extroot/micropub.

8
9
10
11
12
13
14

15
16
17
18
19
20
21
# description: Accepts blog/ticket/chat entries from micropub clients
# version: 0.2
# state: incomplete
# depends: php:sqlite
# doc: https://micropub.spec.indieweb.org/#add,
#     https://github.com/indieweb/micropub-extensions/issues
# config: -

#
# Supposed to feed micropub requests back into `fossil`. Currently supporting
# technotes (which most closely resembles a h-note/blog post), wiki pages (from
# h-entry), tickets (called h-issue in mf2), and chat (from h-event submissions).
#
# Verifies auth/token, unpacks request parameters, and invokes fossil bin
# on the current -R repository.







>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# description: Accepts blog/ticket/chat entries from micropub clients
# version: 0.2
# state: incomplete
# depends: php:sqlite
# doc: https://micropub.spec.indieweb.org/#add,
#     https://github.com/indieweb/micropub-extensions/issues
# config: -
# access: auth
#
# Supposed to feed micropub requests back into `fossil`. Currently supporting
# technotes (which most closely resembles a h-note/blog post), wiki pages (from
# h-entry), tickets (called h-issue in mf2), and chat (from h-event submissions).
#
# Verifies auth/token, unpacks request parameters, and invokes fossil bin
# on the current -R repository.

Changes to extroot/skin.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: config
# category: admin
# title: Skin editor
# description: Edit current skin parts all at once
# version: 0.7
# state: beta
# depends: php:sqlite
# config: -

#
# Combines header/footer/css/js + th1-setup/default-csp editing.
# Updates current=draft1 directly, backs up into draft9.
#
# ยท Permits any user listed in 'draft1-users' setting.
# ยท Stores th1-setup+etc into backup.sql and as draftX-config entries.
# ยท [Save & Apply] button duplicated for convenience, do the same thing.












>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: config
# category: admin
# title: Skin editor
# description: Edit current skin parts all at once
# version: 0.7
# state: beta
# depends: php:sqlite
# config: -
# access: admin
#
# Combines header/footer/css/js + th1-setup/default-csp editing.
# Updates current=draft1 directly, backs up into draft9.
#
# ยท Permits any user listed in 'draft1-users' setting.
# ยท Stores th1-setup+etc into backup.sql and as draftX-config entries.
# ยท [Save & Apply] button duplicated for convenience, do the same thing.

Changes to extroot/sqliteadmin.

1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# api: cgi
# type: form
# category: database
# title: SQLiteAdmin
# description: PHP-based admin tool to manage SQLite2 and SQLite3 databases
# version: 1.9.9-dev
# license: GNU-GPL-v3+
# url: https://www.phpliteadmin.org/

#
# Embeds a slightly modified version of phpLiteAdmin, fixated on the current
# repository database (no file browsing). 
#
#  ยท See `$databases` and `$directory` below to configure shown sqlite files.
#
#  ยท Injects `<div class='fossil-doc'>` to embed the UI within fossil template.










>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# api: cgi
# type: form
# category: database
# title: SQLiteAdmin
# description: PHP-based admin tool to manage SQLite2 and SQLite3 databases
# version: 1.9.9-dev
# license: GNU-GPL-v3+
# url: https://www.phpliteadmin.org/
# access: admin
#
# Embeds a slightly modified version of phpLiteAdmin, fixated on the current
# repository database (no file browsing). 
#
#  ยท See `$databases` and `$directory` below to configure shown sqlite files.
#
#  ยท Injects `<div class='fossil-doc'>` to embed the UI within fossil template.

Changes to extroot/survey.

1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: store
# category: database
# title: Survey submit
# description: Store arbitrary POST form data into a survey_* table
# version: 0.2
# state: alpha
# config: -

#
# Requires a form like:
#
#    <action target="/ext/survey/SAMPLE" method=POST>
#        <input type=checkbox name=q1 value=1>
#        <input type=radio name=q2 value=1>
#        <input type=text name=q3>











>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: store
# category: database
# title: Survey submit
# description: Store arbitrary POST form data into a survey_* table
# version: 0.2
# state: alpha
# config: -
# access: public
#
# Requires a form like:
#
#    <action target="/ext/survey/SAMPLE" method=POST>
#        <input type=checkbox name=q1 value=1>
#        <input type=radio name=q2 value=1>
#        <input type=text name=q3>

Changes to extroot/survey_sum.

1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: display
# category: database
# title: Survey summarize
# description: Only collects
# version: 0.2
# state: alpha
# config: -

#
# Requires a link like  "/ext/survey_sum/SAMPLE",
# and counts the numeric fields (checkboxes yes/no).
# It's just meant for a quick result list, and
# outputs approximate points ๐Ÿž“









|



>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: display
# category: database
# title: Survey summarize
# description: Only collects numeric entries for approximate stats
# version: 0.2
# state: alpha
# config: -
# access: public
#
# Requires a link like  "/ext/survey_sum/SAMPLE",
# and counts the numeric fields (checkboxes yes/no).
# It's just meant for a quick result list, and
# outputs approximate points ๐Ÿž“


Changes to extroot/token.

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: json
# category: auth
# title: IndieAuth token endpoint
# description: Turns an auth token into an access token (but not really)
# version: 0.2
# state: untested
# depends: php:sqlite
# doc: https://indieweb.org/obtaining-an-access-token
# config: -

#
# Counterpart to the `auth` cgi extension. This basically just
# upgrades the authorization code to an access token internally.
# The $2y$-hash token stays, the `fx_auth.type` becomes 'token'.
#
# Request: POST .../token
#    ?grant_type=authorization_code













>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: json
# category: auth
# title: IndieAuth token endpoint
# description: Turns an auth token into an access token (but not really)
# version: 0.2
# state: untested
# depends: php:sqlite
# doc: https://indieweb.org/obtaining-an-access-token
# config: -
# access: auth
#
# Counterpart to the `auth` cgi extension. This basically just
# upgrades the authorization code to an access token internally.
# The $2y$-hash token stays, the `fx_auth.type` becomes 'token'.
#
# Request: POST .../token
#    ?grant_type=authorization_code

Changes to extroot/user_config.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: config
# category: user
# title: User editing
# description: Provides an editing interface to user fields (info/homepage)
# version: 0.3
# state: alpha
# depends: php:sqlite
# config: -

#
# Fairly simple editing UI for user.info table, and possibly some
# new fields. This is basically an addition to the IndieAuth plugin,
# so users can actually update their contact information etc.
#
# New fields must be added in $fields[] atop.
#












>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: config
# category: user
# title: User editing
# description: Provides an editing interface to user fields (info/homepage)
# version: 0.3
# state: alpha
# depends: php:sqlite
# config: -
# access: auth
#
# Fairly simple editing UI for user.info table, and possibly some
# new fields. This is basically an addition to the IndieAuth plugin,
# so users can actually update their contact information etc.
#
# New fields must be added in $fields[] atop.
#