From b87693e4c57f36e528a9d6f46febcac32c90b808 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Thu, 27 Jul 2023 14:34:16 +0200 Subject: use -O3 -Wall gcc flags, add old.reddit.com css --- config.h | 2 +- makefile | 4 +++- plugins/libre_redirect/libre_redirect.c | 2 +- plugins/style/recompute_STYLE_N.sh | 2 +- plugins/style/style.c | 2 +- plugins/style/style.h | 2 +- plugins/style/style.js | 18 ++++++++++++++++++ rose | Bin 47928 -> 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 #include #include -#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 Binary files a/rose and b/rose differ -- cgit v1.2.3