aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNunoSempere <nuno.sempere@protonmail.com>2023-07-27 14:34:16 +0200
committerNunoSempere <nuno.sempere@protonmail.com>2023-07-27 14:34:16 +0200
commitb87693e4c57f36e528a9d6f46febcac32c90b808 (patch)
treecf2cd5d52085def93d1c40de5cf79e8b9e05b527
parente2c81f25957ea542f430132c9c96033ff77cfede (diff)
use -O3 -Wall gcc flags, add old.reddit.com css
-rw-r--r--config.h2
-rw-r--r--makefile4
-rw-r--r--plugins/libre_redirect/libre_redirect.c2
-rwxr-xr-xplugins/style/recompute_STYLE_N.sh2
-rw-r--r--plugins/style/style.c2
-rw-r--r--plugins/style/style.h2
-rw-r--r--plugins/style/style.js18
-rwxr-xr-xrosebin47928 -> 43280 bytes
8 files changed, 26 insertions, 6 deletions
diff --git a/config.h b/config.h
index 251a3c7..4748cb3 100644
--- a/config.h
+++ b/config.h
@@ -12,7 +12,7 @@
#define SEARCH "https://search.nunosempere.com/search?q=%s" // "https://lite.duckduckgo.com/html/?q=%s"
#define HOME ROSE_HOMEPAGE ? "file:///home/loki/Documents/core/software/fresh/C/rose-browser/rosenrot/user-scripts/ubuntu-20.04/rose-images/rose-homepage.png" : "https://search.nunosempere.com/"
// #define HOME ROSE_HOMEPAGE ? "file:///home/loki/Documents/core/software/fresh/C/rose-browser/rosenrot/user-scripts/ubuntu-20.04/rose-images/rose-homepage.png" : "https://search.nunosempere.com/"
-#define CACHE_DIR "/home/loki/.cache/rose"
+#define CACHE_DIR "/home/root/.cache/rose"
#define WIDTH 1920 // 960 for half-width, 1920 for full width
#define HEIGHT 1080
diff --git a/makefile b/makefile
index 43f8eb5..329f3f9 100644
--- a/makefile
+++ b/makefile
@@ -7,6 +7,8 @@
## C compiler
CC=gcc # gcc: more options. Also I don't know whether tcc has error messages/debug options.
+WARNINGS=-Wall
+OPTIMIZED=-O3 #-Ofast
## CC=tcc # tcc: much faster
## Main file
@@ -68,7 +70,7 @@ build: $(SRC) $(PLUGS) $(CONFIG)
sed -i "s|$(DEFAULT_DIR)|$(CURRENT_DIR)|g" {} +
# Compile rosenrot
GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/
- $(CC) $(DEBUG) $(INCS) $(PLUGS) $(SRC) -o rose $(LIBS) $(ADBLOCK)
+ $(CC) $(WARNINGS) $(OPTIMIZED) $(DEBUG) $(INCS) $(PLUGS) $(SRC) -o rose $(LIBS) $(ADBLOCK)
inspect: build
GTK_DEBUG=interactive ./rose
diff --git a/plugins/libre_redirect/libre_redirect.c b/plugins/libre_redirect/libre_redirect.c
index 9d9f414..330522c 100644
--- a/plugins/libre_redirect/libre_redirect.c
+++ b/plugins/libre_redirect/libre_redirect.c
@@ -43,7 +43,7 @@ int libre_redirect(const char* uri, char* output)
};
char* alternatives[] = {
- "https://teddit.nunosempere.com",
+ "https://old.reddit.com", // "https://teddit.nunosempere.com",
"https://yt.artemislena.eu",
"https://search.nunosempere.com",
"https://scribe.rip",
diff --git a/plugins/style/recompute_STYLE_N.sh b/plugins/style/recompute_STYLE_N.sh
index 09faed2..9202894 100755
--- a/plugins/style/recompute_STYLE_N.sh
+++ b/plugins/style/recompute_STYLE_N.sh
@@ -5,5 +5,5 @@ sed_wrapper()
} ## e.g., sedr "s/target/replacement/g"
STYLE_N=`wc -c style.js | cut -d " " -f 1`
-sed_wrapper "s/^#define STYLE_N .*/#define STYLE_N $STYLE_N + 1/g"
+sed_wrapper "s/^#define STYLE_N .*/#define STYLE_N $STYLE_N + 100/g"
diff --git a/plugins/style/style.c b/plugins/style/style.c
index ed7b274..3e907b8 100644
--- a/plugins/style/style.c
+++ b/plugins/style/style.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#define STYLE_N 4023 + 1
+#define STYLE_N 4390 + 100
void read_style_js(char* string)
{
diff --git a/plugins/style/style.h b/plugins/style/style.h
index f11f210..43f34c7 100644
--- a/plugins/style/style.h
+++ b/plugins/style/style.h
@@ -1,7 +1,7 @@
#ifndef STYLE
#define STYLE
-#define STYLE_N 4023 + 1
+#define STYLE_N 4390 + 100
void read_style_js(char* string);
diff --git a/plugins/style/style.js b/plugins/style/style.js
index 8d3254c..c142373 100644
--- a/plugins/style/style.js
+++ b/plugins/style/style.js
@@ -70,6 +70,24 @@ if (document.domain == "twitter.com" ){
`
}
+if (document.domain == "reddit.com" || document.domain == "old.reddit.com"){
+ styles = `
+ /* kill sidebar ads */
+ .native-ad-container,
+ .premium-banner-outer,
+ .native-sidebar-ad,
+ .infobar-toaster-container,
+ #eu-cookie-policy,
+ .ad-container,
+ a[href="/premium"],
+ [data-promoted^="true"],
+ a[href^="https://alb.reddit.com"]
+ {
+ display: none !important;
+ }
+ `
+}
+
if(styles != null){
var styleSheet = document.createElement('style')
styleSheet.innerText = styles
diff --git a/rose b/rose
index 9120a1b..b80085a 100755
--- a/rose
+++ b/rose
Binary files differ