feat: disable plugins code by default and explain how to enable it.
This commit is contained in:
parent
6b3c830c3b
commit
9a533b7e26
2
build.sh
2
build.sh
|
@ -1,6 +1,6 @@
|
||||||
CC=clang
|
CC=clang
|
||||||
SRC=rose.c
|
SRC=rose.c
|
||||||
REQS=./plugins/*/*.c
|
REQS= #./plugins/*/*.c
|
||||||
DEPS=('webkit2gtk-4.0')
|
DEPS=('webkit2gtk-4.0')
|
||||||
|
|
||||||
INCS=`pkg-config --cflags ${DEPS[@]}`
|
INCS=`pkg-config --cflags ${DEPS[@]}`
|
||||||
|
|
55
plugins/libre_redirect/README.md
Normal file
55
plugins/libre_redirect/README.md
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
## About
|
||||||
|
|
||||||
|
This code automatically redirects webpage to their open-source frontends
|
||||||
|
|
||||||
|
To enable it:
|
||||||
|
|
||||||
|
## In build.sh
|
||||||
|
|
||||||
|
Uncomment this line:
|
||||||
|
|
||||||
|
```
|
||||||
|
REQS= #./plugins/*/*.c
|
||||||
|
```
|
||||||
|
|
||||||
|
or alternatively, write the full paths of `libre_redirect.c` and `str_replace_start.c`
|
||||||
|
|
||||||
|
|
||||||
|
### In rose.c
|
||||||
|
|
||||||
|
Uncomment these lines:
|
||||||
|
|
||||||
|
```
|
||||||
|
// #include "plugins/libre_redirect/libre_redirect.h"
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
/*
|
||||||
|
void redirect_if_annoying(WebKitWebView *view, const char *uri){
|
||||||
|
int l = LIBRE_N + strlen(uri) + 1;
|
||||||
|
char uri_filtered[l];
|
||||||
|
str_init(uri_filtered, l);
|
||||||
|
|
||||||
|
int check = libre_redirect(uri, uri_filtered);
|
||||||
|
|
||||||
|
if (check == 2){
|
||||||
|
webkit_web_view_load_uri(view, uri_filtered);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
case WEBKIT_LOAD_STARTED:
|
||||||
|
// redirect_if_annoying(self, webkit_web_view_get_uri(self));
|
||||||
|
break;
|
||||||
|
case WEBKIT_LOAD_REDIRECTED:
|
||||||
|
// redirect_if_annoying(self, webkit_web_view_get_uri(self));
|
||||||
|
break;
|
||||||
|
case WEBKIT_LOAD_COMMITTED:
|
||||||
|
// redirect_if_annoying(self, webkit_web_view_get_uri(self));
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
```
|
10
rose.c
10
rose.c
|
@ -12,7 +12,7 @@
|
||||||
#include <webkit2/webkit2.h>
|
#include <webkit2/webkit2.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "plugins/libre_redirect/libre_redirect.h"
|
// #include "plugins/libre_redirect/libre_redirect.h"
|
||||||
|
|
||||||
#define CACHE \
|
#define CACHE \
|
||||||
"base-cache-directory", CACHE_DIR, \
|
"base-cache-directory", CACHE_DIR, \
|
||||||
|
@ -78,6 +78,7 @@ void load_uri(WebKitWebView *view, const char *uri)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
void redirect_if_annoying(WebKitWebView *view, const char *uri){
|
void redirect_if_annoying(WebKitWebView *view, const char *uri){
|
||||||
int l = LIBRE_N + strlen(uri) + 1;
|
int l = LIBRE_N + strlen(uri) + 1;
|
||||||
char uri_filtered[l];
|
char uri_filtered[l];
|
||||||
|
@ -90,19 +91,20 @@ void redirect_if_annoying(WebKitWebView *view, const char *uri){
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void load_changed(WebKitWebView *self, WebKitLoadEvent load_event, GtkNotebook *notebook)
|
void load_changed(WebKitWebView *self, WebKitLoadEvent load_event, GtkNotebook *notebook)
|
||||||
{
|
{
|
||||||
switch (load_event) {
|
switch (load_event) {
|
||||||
/* see <https://webkitgtk.org/reference/webkit2gtk/2.5.1/WebKitWebView.html> */
|
/* see <https://webkitgtk.org/reference/webkit2gtk/2.5.1/WebKitWebView.html> */
|
||||||
case WEBKIT_LOAD_STARTED:
|
case WEBKIT_LOAD_STARTED:
|
||||||
redirect_if_annoying(self, webkit_web_view_get_uri(self));
|
// redirect_if_annoying(self, webkit_web_view_get_uri(self));
|
||||||
break;
|
break;
|
||||||
case WEBKIT_LOAD_REDIRECTED:
|
case WEBKIT_LOAD_REDIRECTED:
|
||||||
redirect_if_annoying(self, webkit_web_view_get_uri(self));
|
// redirect_if_annoying(self, webkit_web_view_get_uri(self));
|
||||||
break;
|
break;
|
||||||
case WEBKIT_LOAD_COMMITTED:
|
case WEBKIT_LOAD_COMMITTED:
|
||||||
redirect_if_annoying(self, webkit_web_view_get_uri(self));
|
// redirect_if_annoying(self, webkit_web_view_get_uri(self));
|
||||||
break;
|
break;
|
||||||
case WEBKIT_LOAD_FINISHED:
|
case WEBKIT_LOAD_FINISHED:
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user