use browser app for shitcord

one small step closing to completely ridding myself of this heap of
garbage
This commit is contained in:
LordMZTE 2024-03-25 22:54:11 +01:00
parent b6239e30e2
commit f084f919e6
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
12 changed files with 59 additions and 50 deletions

View file

@ -1,8 +0,0 @@
# vim: filetype=firejail
# Make discord use xdg-desktop-portal to open links by pretending
# we're running inside flatpak (eww).
private-bin gdbus
env DE=flatpak
# Whitelist symlink to theme in order to grant access to the link target file.
whitelist ~/.config/discord/theme.css

View file

@ -0,0 +1,9 @@
[Desktop Entry]
Name=Discord
StartupWMClass=discord
Comment=Shitcord Crap Messenger (browser app).
GenericName=Internet Messenger
Exec=openbrowser --app=https://discord.com/login
Icon=discord
Type=Application
Categories=Network;InstantMessaging;

View file

@ -0,0 +1,22 @@
<! local fields = {
name = "MZTE",
version = "0.1.0",
description = "Random Stuff",
author = "LordMZTE",
include = "*",
["run-at"] = "document-start",
grant = {
"GM_registerMenuCommand",
"GM_getValue",
"GM_setValue",
},
} !>
<! -- IMPLEMENTATION !>
// ==UserScript==
<! for k, v in pairs(fields) do
local arr = v[1] and v or {v}
for _, val in ipairs(arr) do !>
// @<% k %> <% val %>
<! end end !>
// ==/UserScript==

View file

@ -3,13 +3,13 @@
z-index: 100000;
right: 0;
bottom: 0;
font-family: "Iosevka Nerd Font", monospace;
color: #cdd6f4;
font-family: "<% opt.font %>", monospace;
color: #<% opt.catppuccin.text %>;
font-size: 20px;
background-color: #1e1e2e;
background-color: #<% opt.catppuccin.base %>;
margin-right: 20px;
margin-bottom: 20px;
border-style: solid;
border-width: 2px;
border-color: #f38ba8;
border-color: #<% opt.catppuccin.red %>;
}

View file

@ -1,14 +1,4 @@
/*
* Based on catppuccin mocha with minor changes.
* Use BeautifulDiscord to inject this.
*/
/* === MZTE === */
:root * {
font-family: "<% opt.font %>" !important;
border-radius: 0 !important;
}
/* Hide the stupid rounding masks on server icons */
:root foreignObject {
mask: none !important;

View file

@ -0,0 +1,4 @@
:root * {
border-radius: 0 !important;
font-family: "<% opt.font %>", monospace !important;
}

View file

@ -1,3 +1,5 @@
cg.addPath "cgassets"
cg.addPath ".config"
cg.addPath ".local"
cg.addPath ".ssh"

View file

@ -1,11 +0,0 @@
// ==UserScript==
// @name MZTE
// @version 0.1.0
// @description Random stuff
// @author LordMZTE
// @include *
// @run-at document-start
// @grant GM_registerMenuCommand
// @grant GM_getValue
// @grant GM_setValue
// ==/UserScript==

View file

@ -1,4 +0,0 @@
/* Hide the stupid rounding masks on server icons */
:root foreignObject {
mask: none !important;
}

View file

@ -1,4 +0,0 @@
:root * {
border-radius: 0 !important;
font-family: "Iosevka Nerd Font", monospace !important;
}

View file

@ -7,23 +7,25 @@ import sys.io.File;
using StringTools;
var assetRoot = "../../cgout/cgassets/tampermonkey-mzte";
macro function init() {
var oldHeader = Context.definedValue("source-header");
var header = Std.string(File.read("assets/header.txt").readAll());
var header = Std.string(File.read('$assetRoot/header.txt').readAll());
Compiler.define("source-header", '$header\n//$oldHeader');
return macro {};
}
macro function fileContent(path:String):haxe.macro.Expr.ExprOf<String> {
return macro $v{Std.string(File.read(path).readAll())};
return macro $v{Std.string(File.read('$assetRoot/$path').readAll())};
}
macro function siteStyles():haxe.macro.Expr.ExprOf<Map<String, String>> {
var map:Array<haxe.macro.Expr> = [];
for (f in FileSystem.readDirectory("assets/site_styles")) {
for (f in FileSystem.readDirectory('$assetRoot/site_styles')) {
if (f.endsWith(".css")) {
map.push(macro $v{f.substr(0, f.length - 4)} => Macro.fileContent($v{'assets/site_styles/$f'}));
map.push(macro $v{f.substr(0, f.length - 4)} => Macro.fileContent($v{'site_styles/$f'}));
}
}

View file

@ -1,13 +1,18 @@
import actions.ClearCookiesAction;
import actions.ToggleStyleAction;
import actions.InfoAction;
import js.Browser;
using Lambda;
function main() {
var siteStyles = Macro.siteStyles();
var ownStyle = Browser.document.createStyleElement();
ownStyle.innerHTML = Macro.fileContent("assets/own_style.css");
ownStyle.innerHTML = Macro.fileContent("own_style.css");
var style = Browser.document.createStyleElement();
style.innerHTML = Macro.fileContent("assets/style.css");
style.innerHTML = Macro.fileContent("style.css");
Browser.document.addEventListener("DOMContentLoaded", () -> {
Browser.document.body.appendChild(ownStyle);
@ -25,7 +30,9 @@ function main() {
}
});
new actions.InfoAction().register();
new actions.ToggleStyleAction(style).register();
new actions.ClearCookiesAction().register();
[
new InfoAction(),
new ToggleStyleAction(style),
new ClearCookiesAction(),
].iter(a -> a.register());
}