Collection of themes/skins for the Fossil SCM

⌈⌋ ⎇ branch:  Fossil Skins Extra


Check-in [8d85a3869b]

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

Overview
Comment:Add experimental hooks admin (not useful yet)
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8d85a3869b5b9515238f80cef763a5220337077e
User & Date: mario 2021-10-20 21:12:45
Context
2021-10-24
06:17
Initial version of webhook sending wrapper check-in: fd9421378c user: mario tags: trunk
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
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to extroot/fx_meta.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: store
# category: template
# title: fx_meta tags (twitter)
# description: populate fx_meta with wiki page + doc file summaries
# version: 0.55
# state: alpha
# config:
#    { name: project-twitter, type: str, value: "", description: "Twitter handle for project (e.g. @sqlite1)" }
# access: admin
#
# Crafts a `fx_meta` database table to prepare twitter previews






|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: store
# category: template
# title: fx_meta cache
# description: Prepare twitter tags for wiki + doc pages
# version: 0.55
# state: alpha
# config:
#    { name: project-twitter, type: str, value: "", description: "Twitter handle for project (e.g. @sqlite1)" }
# access: admin
#
# Crafts a `fx_meta` database table to prepare twitter previews

Added extroot/hooks.





















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: config
# category: admin
# title: Hooks
# description: Configure hooks (e.g. web services)
# version: 0.0
# state: beta
# config: -
# depends: fossil (=2.17)
# access: admin
#
# The `hooks` entry is a JSON list. WARNING: might be subject
# to change. So should not be used without verifying compat.
#

#-- init
include("./fossil_common.php");   # db() etc.
if (!is_admin()) {
    die("Admin-only");
}
error_reporting(E_ALL);

#-- fossil HTML output
function page_md($text) {
    header("Content-Type: text/html; charset=utf-8");
    print <<<EOF
<div class='fossil-doc' data-title='Hooks setup'>
<style>
 .config-list label {
    display: block;
    margin-bottom: 10pt;
    border-left: 3pt #ddd solid;
    border-radius: 5pt 0 0 5pt;
    padding-left: 10pt;
 }
 .save-button {
    padding: 2pt 30pt;
 }
</style>
$text
EOF;
}

#-- print hook row
function hook_row($i, $row, $rows=1, $h="h") {
    print <<<END
    <tr>
        <td>$i</td>
        <td><input list=hooktypes name="hooks[type][$i]" value="{$h($row["type"])}" size=13></td>
        <td><textarea name="hooks[cmd][$i]" cols=75 rows=$rows>{$h($row["cmd"])}</textarea></td>
        <td><input name="hooks[seq][$i]" value="{$h($row["seq"])}" size=3></td>
    </tr>
END;
    /*  <td>{$h($i)}</td>
        <td>{$h($row["type"])}</td>
        <td>{$h($row["cmd"])}</td>
        <td>{$h($row["seq"])}</td>  */
}


#-- iterate over scripts for display
page_md("
  <div class=config-list>
  <form method=POST enctype='multipart/form-data'>
    <datalist id=hooktypes>
      <option value=after-receive title='after every commit or push/pull'>
      <option value=before-commit>
      <option value=commit-msg>
      <option value=disabled>
    </datalist>
  <table>
  <tr> <th>#</th> <th>type</th> <th>command</th> <th>seq</th> </tr>
");
$hooks = json_decode(get_config("hooks", "[]"), TRUE);
foreach ($hooks as $i=>$row) {
    hook_row($i, $row);
}
hook_row(count($hooks), ["type"=>"after-receive", "cmd"=>"", "seq"=>50], 3);
#print_r($_SERVER);
?>
<tr><td colspan=4 align=center><input type=submit value="Add / Save" class=save-button></td></tr>
</table>
</form>
<h3>Web hooks</h3>
<p>
Add one of the standard webhook services:
</p>
<p>
<select id=web_set onchange="document.getElementById('hook_cmd').innerText=this.value">
<option value=''>
<option value='curl -X POST -d "branches=trunk" -d "token=1234" https://readthedocs.org/api/v2/webhook/example-project/1/'>ReadTheDocs
<option value='wget https://127.0.0.1/jenkins/github-webook'>Jenkins
<option value='wget https://localhost:8080/ext/fx_meta'>fossil/ext/fx_meta
</select>
</p>

<h3>Docs</h3>
<ul>
<li> See <a href="https://fossil-scm.org/home/doc/trunk/www/hooks.md">hooks.md</a> on how commands are run.
<li> Emulate https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads …
<li> Probably needs a cmdline helper <code>fossil-webhook</code>
</ul>
</div>