Refactoring to use frantic from paranoia.wf's format. Greentext is back

This commit is contained in:
q 2024-09-14 17:03:50 -04:00
parent d51f27a64a
commit c375363a8c
11 changed files with 0 additions and 322 deletions

View File

@ -1,30 +0,0 @@
This is an archive of the old patches project. Some of these patches no longer work. It is recommended to use the new project instead.
# Glowers Club Element Patches
This contains everything used to patch Glowers Club's Element instance. This patch does the following:
- ~~Changes messages you send starting with ">" to be chan-style greentext instead of Reddit-style block quotes~~ No longer works on latest Element Web. I blame Travis. PRs welcome.
- Adds custom login background (replace lake.jpg with any background you want)
- Adds custom text reactions in the emoji menu (at the bottom of the "Symbols" section). Change reactions.yaml to have any you want.
- Modifies the CSS for the emoji picker so the text reactions don't overflow to other emoji
- Replaces the default config.json with the one here
- In response to [Element devs renaming Kick to Remove](https://github.com/vector-im/element-web/issues/9547):
- Remove has been renamed to Holocaust
- Ban has been renamed to Gas
- Custom notification sound (replace message.mp3 and message.ogg with whatever sound you want)
## Dependencies
1. Everything already needed to build Element Web
2. jq
3. yq
4. patch
## Instructions
1. `git clone https://github.com/vector-im/element-web.git`
2. `cd element-web`
3. `git clone https://code.glowers.club/q/element-web-patches.git`
4. `yarn`
5. `cd element-web-patches`
6. `bash ./code_patches.sh`
7. `cd .. && yarn dist`

View File

@ -1,62 +0,0 @@
#!/bin/bash
set -euo pipefail
LWD="$PWD"
# TODO: cleanup, generify backup
echo 'Backing up EmojiProvider.tsx...'
if [ ! -f ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider_backup.tsx ]; then
cp ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider.tsx ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider_backup.tsx
else
cp ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider_backup.tsx ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider.tsx
fi
echo 'Backing up compact.json...'
if [ ! -f ../node_modules/emojibase-data/en/compact_backup.json ]; then
cp ../node_modules/emojibase-data/en/compact.json ../node_modules/emojibase-data/en/compact_backup.json
else
cp ../node_modules/emojibase-data/en/compact_backup.json ../node_modules/emojibase-data/en/compact.json
fi
echo 'Adding custom emoji...'
{
cd ./reactions;
./generate.sh > "./data-injects~.json";
jq -sc '.[0] + .[1]' "../../node_modules/emojibase-data/en/compact_backup.json" "./data-injects~.json" > "../../node_modules/emojibase-data/en/compact.json";
rm "./data-injects~.json";
cd "$LWD";
} || { echo "Failed to inject reactions: Exit code $?" 1>&2; exit $?; }
echo 'Copying custom login background...'
cp -f ./lake.jpg ../res/themes/element/img/backgrounds/lake.jpg
echo 'Copying custom config.json...'
cp -f ./config.json ../config.sample.json
echo 'Backing up _EmojiPicker.pcss...'
if [ ! -f ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.pcss.backup ]; then
cp ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.pcss ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.pcss.backup
else
cp ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.pcss.backup ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.pcss
fi
echo 'Adding custom emoji picker CSS...'
echo "
.mx_EmojiPicker_item_wrapper {
text-overflow: clip;
white-space: nowrap;
overflow: hidden;
}" >> ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.pcss
#echo 'Adding greentext patch...'
#patch "../node_modules/commonmark/dist/commonmark.js" ./greentext.patch
echo 'running kick fix...'
./fix_kick.sh
echo 'Adding custom notification sound...'
cp ./message.mp3 ../webapp/media/message.mp3
cp ./message.mp3 ../node_modules/matrix-react-sdk/res/media/message.mp3
cp ./message.ogg ../webapp/media/message.ogg
cp ./message.ogg ../node_modules/matrix-react-sdk/res/media/message.ogg

View File

@ -1,71 +0,0 @@
{
"default_server_config": {
"m.homeserver": {
"base_url": "https://glowers.club",
"server_name": "Glowers Club"
}
},
"disable_custom_urls": false,
"disable_guests": true,
"disable_login_language_selector": false,
"disable_3pid_login": false,
"brand": "Glowers Club",
"integrations_ui_url": "https://dimension.midov.pl/element",
"integrations_rest_url": "https://dimension.midov.pl/api/v1/scalar",
"integrations_widgets_urls": ["https://dimension.midov.pl/widgets"],
"integrations_jitsi_widget_url": "https://dimension.midov.pl/widgets/jitsi",
"bug_report_endpoint_url": "https://element.io/bugreports/submit",
"defaultCountryCode": "US",
"showLabsSettings": true,
"features": {
"feature_many_integration_managers": "labs",
"feature_pinning": "enable",
"feature_custom_tags": "labs",
"feature_state_counters": "labs",
"feature_custom_themes" : "labs",
"feature_bridge_state": "labs",
"feature_mjolnir" : "labs",
"feature_presence_in_room_list": "labs",
"feature_roomlist_preview_reactions_all": "labs",
"feature_roomlist_preview_reactions_dms": "labs",
"feature_dm_verification": "labs",
"feature_latex_maths": "labs",
"feature_dehydration": "labs",
"feature_report_to_moderators": "labs",
"feature_polls": "labs",
"feature_location_share_pin_drop": "labs",
"feature_location_share_live": "labs",
"feature_spotlight": "labs",
"feature_jump_to_date": "labs",
"feature_video_rooms": "labs",
"feature_html_topic": "labs",
"feature_exploring_public_spaces": "labs",
"feature_favourite_messages": "labs",
"feature_element_call_video_rooms": "labs",
"feature_group_calls": "labs",
"feature_qr_signin_reciprocate_show": "labs",
"feature_rust_crypto": "disable",
"feature_ask_to_join": "enable",
"feature_notifications": "enable",
"feature_extensible_events": "labs"
},
"default_federate": true,
"default_theme": "dark",
"roomDirectory": {
"servers": [
"glowers.club",
"200acres.org",
"matrix.kiwifarms.net",
"matrix.org",
"midov.pl",
"nerdsin.space",
"poa.st"
]
},
"jitsi": {
"preferredDomain": "meet.element.io"
},
"enable_presence_by_hs_url": {
"https://glowers.club": false
}
}

View File

@ -1,40 +0,0 @@
#!/bin/sh
# TODO: Check `set -euo pipefail` compat
# just to fix kick
sed -i -e 's/remove/holocaust/g' \
-e 's/Removes/Holocausts/g' ../node_modules/matrix-react-sdk/src/SlashCommands.tsx
sed -i -e 's/senderName)s removed %(targetName/senderName)s holocausted %(targetName/g' ../node_modules/matrix-react-sdk/src/TextForEvent.tsx
sed -i -e 's/"Remove/"Holocaust/g' \
-e 's/Failed to remove/Failed to holocaust/g' ../node_modules/matrix-react-sdk/src/components/views/right_panel/UserInfo.tsx
sed -i -e 's/removed/holocausted/g' ../node_modules/matrix-react-sdk/src/components/views/rooms/RoomPreviewBar.tsx
sed -i -e 's/Remove users/Holocaust users/g' ../node_modules/matrix-react-sdk/src/components/views/settings/tabs/room/RolesRoomSettingsTab.tsx
sed -i -e 's/Removes user/Holocausts user/g' \
-e 's/)s removed %(tar/)s holocausted %(tar/g' \
-e 's/"Remove,/"Holocaust,/g' \
-e 's/You were removed/You were holocausted/g' \
-e 's/Remove from/Holocaust from/g' \
-e 's/removed %(count)s times"/holocausted %(count)s times"/g' \
-e 's/removed"/holocausted"/g' \
-e 's/"Remove recent messages"/"Holocaust recent messages"/g' ../node_modules/matrix-react-sdk/src/i18n/strings/en_EN.json
sed -i -e 's/removes/holocausts/g' ../node_modules/matrix-react-sdk/src/settings/Settings.tsx
sed -i -e 's/Remove/Holocaust/g' ../node_modules/matrix-react-sdk/src/widgets/CapabilityText.tsx
# replace ban messages
sed -i -e 's/"Ban"/"Gas"/g' ../node_modules/matrix-react-sdk/src/components/views/right_panel/UserInfo.tsx
sed -i -e 's/Bans user with given id",/Gasses user with given id",/g' \
-e 's/"Ban from %(roomName)s",/"Gas from %(roomName)s",/g' \
-e 's/"Ban"/"Gas"/g' \
-e 's/"Banned by %(displayName)s",/"Gassed by %(displayName)s",/g' \
-e 's/"Banned users",/"Gassed users",/g' \
-e 's/was banned",/was gassed",/g' \
-e 's/was banned %(count)s times",/was gassed %(count)s times",/g' \
-e 's/were banned",/were gassed",/g' \
-e 's/banned from %(roomName)s by %(memberName)s",/gassed from %(roomName)s by %(memberName)s",/g' \
-e 's/were banned %(count)s times",/were gassed %(count)s times",/g' \
-e 's/s banned %(targetName)s: %(reason)s",/s gassed %(targetName)s: %(reason)s",/g' \
-e 's,/removes/,/holocausts/,g' \
-e 's/"Remove them from/"Holocaust him from/g' \
-e 's/s banned %(targetName)s",/s gassed %(targetName)s",/g' ../node_modules/matrix-react-sdk/src/i18n/strings/en_EN.json

View File

@ -1,56 +0,0 @@
--- ./commonmark.js.original 2021-03-27 12:41:48.000000000 -0400
+++ ./commonmark.js 2021-07-21 17:51:49.408590728 -0400
@@ -9877,17 +9877,42 @@
this.cr();
}
- function block_quote(node, entering) {
- var attrs = this.attrs(node);
- if (entering) {
- this.cr();
- this.tag("blockquote", attrs);
- this.cr();
- } else {
- this.cr();
- this.tag("/blockquote");
- this.cr();
- }
+ function block_quote(node, entering) {
+ var attrs = this.attrs(node);
+ if (node.firstChild !== null) {
+ var w = node.walker(), e, m=node.firstChild
+ while (m.firstChild !== null)
+ m = m.firstChild
+ while (m.type !== 'document') {
+ if (m.type == 'text' && m.literal[0] !== '>')
+ m.literal = '>' + m.literal
+ m = m.parent
+ }
+ while (e = w.next()) {
+ const n = e.node
+ if (e.entering == false)
+ continue
+ if (n.type == 'text') {
+ let o = n.parent
+ while (o.type !== 'document')
+ if (o.type == 'block_quote')
+ break
+ else
+ o = o.parent
+ if (o.type == 'block_quote' && (n.prev && n.prev.type == 'softbreak') && n.literal[0] !== '>') {
+ n.literal = '>' + n.literal
+ }
+ }
+ }
+ }
+
+ if (entering) {
+ this.tag('font', [...attrs, ['color', '#789922']]);
+ if (!node.firstChild)
+ this.buffer += '<p>&gt;</p>'
+ } else {
+ this.tag('/font');
+ }
}
function list(node, entering) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +0,0 @@
#!/bin/sh
base="https://raw.githubusercontent.com/milesj/emojibase/master/packages/data/en"
for file in compact.raw.json data.raw.json; do
echo "$file:"
curl -sf "$base/$file" | jq '.[] | select(.hexcode == "2721")' || exit $?
done

View File

@ -1,24 +0,0 @@
#!/bin/sh
# Run fetch-latest-format.sh for the most up-to-date emojibase format. Target is raw.json
reactions="$(yq . /dev/stdin < reactions.yaml)"
jq -n --argjson reactions "$reactions" \
'[
$reactions[] | {
annotation: .emoji,
label: .emoji,
emoticon: .emoji,
hexcode: "2721",
unicode: .emoji,
shortcodes: (.tags? + [ .emoji ]),
tags: (.tags? + [ .emoji ]),
emoji: .emoji,
text: .emoji,
type: 0,
order: 0,
group: 8,
subgroup: 93,
version: 0.7
}
]'

View File

@ -1,33 +0,0 @@
- emoji: based
- emoji: cringe
- emoji: yikes
- emoji: cope
- emoji: seethe
- emoji: dilate
- emoji: '>'
- emoji: 't. jewish'
- emoji: 't. tard'
- emoji: '>implying'
- emoji: '>she'
- emoji: '>her'
- emoji: 'tard moment'
- emoji: 'woman moment'
- emoji: Yes.
- emoji: No.
- emoji: (You)
- emoji: lol
- emoji: RAPE
- emoji: F
- emoji: vaggot
- emoji: vaxnigger
- emoji: Fag
- emoji: simp
- emoji: piss
- emoji: jelq
- emoji: coom
- emoji: booba
- emoji: sinner
- emoji: repent
- emoji:
tags:
- swastika