Request to add more setting options #49

Open
opened 2024-11-26 05:56:00 +00:00 by Ghost · 9 comments

More information can be referenced : https://docs.searxng.org/admin/settings/settings_search.html

Optional safe search filter results level

Custom Autocomplete Suggestions

Custom Display Site Favicons

Open Links in a New Tab

*The Snippet Content of search results cannot be easily copied on mobile devices :(

Also, why is the Default Country for image search not set to All regions ?

Furthermore, git․lolcat․ca/robots.txt has not yet been created

More information can be referenced : https://docs.searxng.org/admin/settings/settings_search.html Optional safe search filter results level Custom Autocomplete Suggestions Custom Display Site Favicons Open Links in a New Tab *The Snippet Content of search results cannot be easily copied on mobile devices :( Also, why is the Default Country for image search not set to All regions ? Furthermore, git․lolcat․ca/robots.txt has not yet been created
Owner

Also, why is the Default Country for image search not set to All regions ?

it depends of the scraper. Sometimes, that setting is not available.

Thank you for your suggestions xoxo

>Also, why is the Default Country for image search not set to All regions ? it depends of the scraper. Sometimes, that setting is not available. Thank you for your suggestions xoxo

pls, add option in settings "Open Links in a New Tab". please
Because of this, it is verrrry inconvenient to use search on Android (Fennec). Because you have to press 3 buttons every time instead of 1, and also if you don't use new tab, you have to click back many times to get back to the search.
Please tell me what is the difficulty in implementing this? (for my understanding)

pls, add option in settings "Open Links in a New Tab". please Because of this, it is verrrry inconvenient to use search on Android (Fennec). Because you have to press 3 buttons every time instead of 1, and also if you don't use new tab, you have to click back many times to get back to the search. Please tell me what is the difficulty in implementing this? (for my understanding)

@Dituar Just looked into that, and it's easy to add. I've got something working on my end.


In the settings.php file, the following setting could be added:

			[
				"description" => "Open links in new tab",
				"parameter" => "open_in_new_tab",
				"options" => [
					[
						"value" => "_self",
						"text" => "No"
					],
					[
						"value" => "_blank",
						"text" => "Yes"
					]
				]
			]

In the frontend.php file, the drawtextresult function could be updated where it draws the title and description:

$payload .=
			'<a href="' . htmlspecialchars($site["url"]) . '" class="hover" rel="noreferrer nofollow" target="' . htmlspecialchars($_COOKIE["open_in_new_tab"]) . '"';
@Dituar Just looked into that, and it's easy to add. I've got something working on my end. ___ In the __settings.php__ file, the following setting could be added: ```php [ "description" => "Open links in new tab", "parameter" => "open_in_new_tab", "options" => [ [ "value" => "_self", "text" => "No" ], [ "value" => "_blank", "text" => "Yes" ] ] ] ``` In the __frontend.php__ file, the `drawtextresult` function could be updated where it draws the title and description: ```php $payload .= '<a href="' . htmlspecialchars($site["url"]) . '" class="hover" rel="noreferrer nofollow" target="' . htmlspecialchars($_COOKIE["open_in_new_tab"]) . '"'; ```
Owner

@Korbs This is a very poor way of handling it.

$_COOKIE["open_in_new_tab"] is needlessly long so it adds a lot of network overhead. Furthermore, you don't sanitize the value at all so a maliciously crafted cookie could run XSS on the target's browser.

Do not do this.

@Korbs This is a very poor way of handling it. `$_COOKIE["open_in_new_tab"]` is needlessly long so it adds a lot of network overhead. Furthermore, you don't sanitize the value at all so a maliciously crafted cookie could run XSS on the target's browser. Do not do this.

thats right, ure all morons lolol
add more birde

thats right, ure all morons lolol add more birde

do it ureself dumb lazy fuck
also suggestion download gogle.exe

do it ureself dumb lazy fuck also suggestion download gogle.exe

@Korbs This is a very poor way of handling it.

$_COOKIE["open_in_new_tab"] is needlessly long so it adds a lot of network overhead. Furthermore, you don't sanitize the value at all so a maliciously crafted cookie could run XSS on the target's browser.

Do not do this.

I said I got something working on my end and could be a way, but I never said should. I didn't make a pull request for a reason, because you would do this better, way better, since I'm don't know much about PHP and 4get's source code.

As for the network overhead and cookies, I'll keep that noted. Thanks for letting me know.

> @Korbs This is a very poor way of handling it. > > `$_COOKIE["open_in_new_tab"]` is needlessly long so it adds a lot of network overhead. Furthermore, you don't sanitize the value at all so a maliciously crafted cookie could run XSS on the target's browser. > > Do not do this. I said I got something working on my end and could be a way, but I never said should. I didn't make a pull request for a reason, because you would do this better, way better, since I'm don't know much about PHP and 4get's source code. As for the network overhead and cookies, I'll keep that noted. Thanks for letting me know.

@Dituar

pls, add option in settings "Open Links in a New Tab".

I found the UserScript for the Tampermonkey extension
https://gist.github.com/abhiomkar/458640#file-top2blank-js

// ==UserScript==
// @name		   top2blank
// @description    Set External links' target value to _blank
// @namespace      http://abhiomkar.in
// @include        http://*
// @include        https://*
// ==/UserScript==

aTags = document.getElementsByTagName("a");

for(i=0; i< aTags.length; i++) {
	protocol = window.location.protocol+"//";
	host = window.location.hostname;
	url = aTags[i].href;
	if(url.indexOf("http://") == 0 || url.indexOf("https://") == 0){
		// This may be internal link or external link
		if (url.indexOf("http://") == 0){
			url = url.replace("http://","");
		}
		else if(url.indexOf("https://") == 0){
			url = url.replace("https://","");
		}
		
		if( url.indexOf("/") >= 0 ){
			// Example: http://google.com/images
			url = url.substring(0, url.indexOf("/"));
			if( url == host ){
				// Internal link
				// Do Nothing
			}
			else{
				// Yah!! External link
				// change the target attribute to _blank
				//	console.log("Changing " + aTags[i].href + " to _blank");
				aTags[i].target = "_blank";
			}
		}
	}
}

And it works well on Android (Firefox) on all sites (can be configured to work on specific sites: change the line // @include https://* to // @include https://4get.ca*).
Maybe it will be useful to someone, until 4get add this setting.

@Dituar > pls, add option in settings "Open Links in a New Tab". I found the UserScript for the Tampermonkey extension https://gist.github.com/abhiomkar/458640#file-top2blank-js ``` // ==UserScript== // @name top2blank // @description Set External links' target value to _blank // @namespace http://abhiomkar.in // @include http://* // @include https://* // ==/UserScript== aTags = document.getElementsByTagName("a"); for(i=0; i< aTags.length; i++) { protocol = window.location.protocol+"//"; host = window.location.hostname; url = aTags[i].href; if(url.indexOf("http://") == 0 || url.indexOf("https://") == 0){ // This may be internal link or external link if (url.indexOf("http://") == 0){ url = url.replace("http://",""); } else if(url.indexOf("https://") == 0){ url = url.replace("https://",""); } if( url.indexOf("/") >= 0 ){ // Example: http://google.com/images url = url.substring(0, url.indexOf("/")); if( url == host ){ // Internal link // Do Nothing } else{ // Yah!! External link // change the target attribute to _blank // console.log("Changing " + aTags[i].href + " to _blank"); aTags[i].target = "_blank"; } } } } ``` And it works well on Android (Firefox) on all sites (can be configured to work on specific sites: change the line `// @include https://*` to `// @include https://4get.ca*`). Maybe it will be useful to someone, until 4get add this setting.

@Dituar

And it works well on Android (Firefox)

but that code not work on PC, very old, and have many notes from Tampermonkey.
I write UserScript for the Tampermonkey (with ChatGPT, i'm not coder), this code works on PC too, can be customized, can handle infinite scrollable pages.
https://gist.github.com/Dituar/fb88d2c84068a75ef313e48d59605d8f

PS. idc why all code not normally displayed in the bb "code", so I attached it to the ExternalLinks2NewTab.txt

@Dituar > And it works well on Android (Firefox) but that code not work on PC, very old, and have many notes from Tampermonkey. I write UserScript for the Tampermonkey (with ChatGPT, i'm not coder), this code works on PC too, can be customized, can handle infinite scrollable pages. https://gist.github.com/Dituar/fb88d2c84068a75ef313e48d59605d8f PS. idc why all code not normally displayed in the bb "code", so I attached it to the ExternalLinks2NewTab.txt
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: lolcat/4get#49
No description provided.