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; z-index: 100000;
right: 0; right: 0;
bottom: 0; bottom: 0;
font-family: "Iosevka Nerd Font", monospace; font-family: "<% opt.font %>", monospace;
color: #cdd6f4; color: #<% opt.catppuccin.text %>;
font-size: 20px; font-size: 20px;
background-color: #1e1e2e; background-color: #<% opt.catppuccin.base %>;
margin-right: 20px; margin-right: 20px;
margin-bottom: 20px; margin-bottom: 20px;
border-style: solid; border-style: solid;
border-width: 2px; 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 === */ /* === MZTE === */
:root * {
font-family: "<% opt.font %>" !important;
border-radius: 0 !important;
}
/* Hide the stupid rounding masks on server icons */ /* Hide the stupid rounding masks on server icons */
:root foreignObject { :root foreignObject {
mask: none !important; 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 ".config"
cg.addPath ".local" cg.addPath ".local"
cg.addPath ".ssh" 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; using StringTools;
var assetRoot = "../../cgout/cgassets/tampermonkey-mzte";
macro function init() { macro function init() {
var oldHeader = Context.definedValue("source-header"); 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'); Compiler.define("source-header", '$header\n//$oldHeader');
return macro {}; return macro {};
} }
macro function fileContent(path:String):haxe.macro.Expr.ExprOf<String> { 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>> { macro function siteStyles():haxe.macro.Expr.ExprOf<Map<String, String>> {
var map:Array<haxe.macro.Expr> = []; 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")) { 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; import js.Browser;
using Lambda;
function main() { function main() {
var siteStyles = Macro.siteStyles(); var siteStyles = Macro.siteStyles();
var ownStyle = Browser.document.createStyleElement(); 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(); var style = Browser.document.createStyleElement();
style.innerHTML = Macro.fileContent("assets/style.css"); style.innerHTML = Macro.fileContent("style.css");
Browser.document.addEventListener("DOMContentLoaded", () -> { Browser.document.addEventListener("DOMContentLoaded", () -> {
Browser.document.body.appendChild(ownStyle); Browser.document.body.appendChild(ownStyle);
@ -25,7 +30,9 @@ function main() {
} }
}); });
new actions.InfoAction().register(); [
new actions.ToggleStyleAction(style).register(); new InfoAction(),
new actions.ClearCookiesAction().register(); new ToggleStyleAction(style),
new ClearCookiesAction(),
].iter(a -> a.register());
} }