diff --git a/gen_stats b/gen_stats index b827f9f..dc955c8 100755 --- a/gen_stats +++ b/gen_stats @@ -7,26 +7,43 @@ r.raise_for_status() out = {} d = xml.fromstring(r.text) assert d.tag == "inspircdstats" -def define(name,xps,vfilter=lambda x: x): - global out - out[name] = vfilter(d.findall(xps)[0].text) -define("usercount","./general/usercount",int) -define("channelcount","./general/channelcount",int) + + +def define(name, xps, vfilter=lambda x: x): + global out + out[name] = vfilter(d.findall(xps)[0].text) + + +define("usercount", "./general/usercount", int) +define("channelcount", "./general/channelcount", int) schannels = d.findall("./channellist/channel") -#print(len(schannels)) +# print(len(schannels)) channels = [] for schannel in schannels: - channel = dict(name=schannel.findall("channelname")[0].text,usercount=int(schannel.findall("usercount")[0].text)) - channel["topic"] = schannel.findall("./channeltopic/topictext")[0].text if schannel.findall("./channeltopic/topictext")[0].text is not None else "No topic set" - # bugfix: if mode s is set and there's a topic, hide the topic - if "s" in schannel.findall("./channelmodes")[0].text.split()[0] and channel["topic"]!="No topic set": - channel["topic"]="Topic hidden" - if channel["name"]=="#secret-sudoers": # no stat output for #secret-sudoers! it's a sekrit club of the ~team sysadmins! - continue - channel["webchatlink"] = "https://web.tilde.chat/?join="+channel["name"].lstrip("#") - channels.append(channel) + channel = dict( + name=schannel.findall("channelname")[0].text, + usercount=int(schannel.findall("usercount")[0].text), + ) + channel["topic"] = ( + schannel.findall("./channeltopic/topictext")[0].text + if schannel.findall("./channeltopic/topictext")[0].text is not None + else "No topic set" + ) + # bugfix: if mode s is set and there's a topic, hide the topic + if ( + "s" in schannel.findall("./channelmodes")[0].text.split()[0] + and channel["topic"] != "No topic set" + ): + channel["topic"] = "Topic hidden" + if channel["name"] == "#secret-sudoers": + # no stat output for #secret-sudoers! it's a sekrit club of the ~team sysadmins! + continue + channel["webchatlink"] = "https://web.tilde.chat/?join=" + channel["name"].lstrip( + "#" + ) + channels.append(channel) channels.sort(key=lambda x: x["name"].lower()) -out["channels"]=channels -#print([x.text for x in d.findall("./channellist/channel/channeltopic/topictext")]) -with open("/var/www/tilde.chat/stats.json","w") as f: - json.dump(out,f) +out["channels"] = channels +# print([x.text for x in d.findall("./channellist/channel/channeltopic/topictext")]) +with open("/var/www/tilde.chat/stats.json", "w") as f: + json.dump(out, f) diff --git a/members.json b/members.json index 69b488c..f27f504 100644 --- a/members.json +++ b/members.json @@ -1,17 +1,5 @@ { "members": [ - { - "private_channel": "#fun", - "name": "tilde.fun", - "sysadmins": [ - [ - "shiki", - "https://tilde.fun/~shiki/" - ] - ], - "link": "https://tilde.fun", - "description": "Linux machine on the internet where you can get a shell account" - }, { "private_channel": "#town", "name": "tilde.town", @@ -55,6 +43,18 @@ ], "link": "https://yourtilde.com", "description": "basically a social network inside SSH: there is chat, email, forums, games, and lots more." + }, + { + "private_channel": "#fun", + "name": "tilde.fun", + "sysadmins": [ + [ + "shiki", + "https://tilde.fun/~shiki/" + ] + ], + "link": "https://tilde.fun", + "description": "Linux machine on the internet where you can get a shell account" } ] } diff --git a/navbar.php b/navbar.php index 530d800..00e6880 100644 --- a/navbar.php +++ b/navbar.php @@ -18,7 +18,7 @@
diff --git a/stats.php b/stats/index.php similarity index 75% rename from stats.php rename to stats/index.php index c4c18fe..7814adb 100644 --- a/stats.php +++ b/stats/index.php @@ -1,9 +1,9 @@ +include __DIR__."/../header.php"; ?>There are =$stats->usercount?> users across =$stats->channelcount?> channels.
Available in JSON format.
- +Available in JSON format.
+ diff --git a/wiki/README.md b/wiki/README.md index 9a12f66..9477932 100644 --- a/wiki/README.md +++ b/wiki/README.md @@ -4,7 +4,7 @@ hi there, welcome to our wiki! to contribute to the wiki: -* [fork the repo](https://git.tildeverse.org/repo/fork/53) +* [fork the repo](https://tildegit.org/repo/fork/53) * clone the repo to your local machine (or your public_html folder on the tilde.team box for live testing) ```sh @@ -23,14 +23,14 @@ cp template.md my-new-page.md * edit as needed! -* commit your changes and [create a pull request](https://git.tildeverse.org/tildeverse/tilde.chat/pulls) :) +* commit your changes and [create a pull request](https://tildegit.org/tildeverse/tilde.chat/pulls) :) ```sh git add --all git commit -m "added my-new-page" git push origin my-new-page # this should match the branch name you created earlier ``` -* create a pull request on the [site](https://git.tildeverse.org/tildeverse/tilde.chat) repo +* create a pull request on the [site](https://tildegit.org/tildeverse/tilde.chat) repo thanks!~ diff --git a/wiki/index.php b/wiki/index.php index d370758..460323b 100644 --- a/wiki/index.php +++ b/wiki/index.php @@ -46,7 +46,7 @@ if (!isset($_GET["page"]) || !file_exists("pages/{$_GET['page']}.md")) {welcome to the tilde.chat wiki!
if you want to contribute, check out the - source and open a PR! + source and open a PR!