summaryrefslogtreecommitdiff
path: root/nonfree/min
diff options
context:
space:
mode:
authorAndreas Grapentin <andreas@grapentin.org>2019-02-08 23:01:04 +0100
committerAndreas Grapentin <andreas@grapentin.org>2019-02-08 23:01:04 +0100
commit04fc41a7d944dcc5b7b7be265aa4982ea5a4db2e (patch)
tree9bbf1919272207780662c82a4dd4fda85302a106 /nonfree/min
parent63a2fd1c33db9410d56321f76182f6e92cedf216 (diff)
downloadabslibre-04fc41a7d944dcc5b7b7be265aa4982ea5a4db2e.tar.gz
abslibre-04fc41a7d944dcc5b7b7be265aa4982ea5a4db2e.tar.bz2
abslibre-04fc41a7d944dcc5b7b7be265aa4982ea5a4db2e.zip
libre/min: moved to nonfree (depends on electron)
Diffstat (limited to 'nonfree/min')
-rw-r--r--nonfree/min/PKGBUILD85
-rw-r--r--nonfree/min/icon.patch10
-rw-r--r--nonfree/min/min.desktop9
-rw-r--r--nonfree/min/min.js29
-rw-r--r--nonfree/min/remove_nonprivacy_options.patch107
5 files changed, 240 insertions, 0 deletions
diff --git a/nonfree/min/PKGBUILD b/nonfree/min/PKGBUILD
new file mode 100644
index 000000000..5787f475b
--- /dev/null
+++ b/nonfree/min/PKGBUILD
@@ -0,0 +1,85 @@
+# Maintainer (Arch): Nicola Squartini <tensor5@gmail.com>
+# Maintainer: André Silva <emulatorman@hyperbola.info>
+
+pkgname=min
+pkgver=1.8.1
+pkgrel=1
+pkgrel+=.parabola1
+pkgdesc='A smarter, faster web browser'
+pkgdesc+=', without non-privacy search engines'
+arch=('any')
+url='https://minbrowser.github.io/min'
+license=('Apache')
+depends=('electron')
+makedepends=('grunt-cli' 'npm')
+source=("${pkgname}-${pkgver}.tar.gz::https://github.com/minbrowser/min/archive/v${pkgver}.tar.gz"
+ 'min.desktop'
+ 'min.js'
+ 'icon.patch'
+ 'remove_nonprivacy_options.patch')
+sha256sums=('56e5f03fc969bd5ebbb900fc89987c28e19e09710590ae9e9db47422b79a7d50'
+ 'a779a8daff1d684779ebc6d13ea4c2f09e838df018de41fa19fa3f25aa12e32f'
+ 'c22324184b72b3fad5a0aadb4e18182414e0294c5596c26426adc204fd473258'
+ 'bb5e55a3c4074e1419f25b0605b77ef622d2870235309e0feed88f790967a936'
+ '76c8cc886007be01301c619b3ac1fc86369448e641ca9ae667a2cdd84b9c2276')
+
+prepare() {
+ cd ${pkgname}-${pkgver}
+
+ patch -Np1 -i "${srcdir}"/icon.patch
+ patch -Np1 -i "${srcdir}"/remove_nonprivacy_options.patch
+}
+
+build() {
+ cd ${pkgname}-${pkgver}
+
+ npm install
+ grunt
+ rm -r node_modules
+
+ npm install --production --no-optional
+}
+
+package() {
+ cd ${pkgname}-${pkgver}
+
+ appdir=/usr/lib/${pkgname}
+
+ install -dm755 "${pkgdir}"${appdir}
+ cp -r * "${pkgdir}"${appdir}
+
+ install -dm755 "${pkgdir}"/usr/share/icons/hicolor/256x256/apps
+ mv icons/icon256.png \
+ "${pkgdir}"/usr/share/icons/hicolor/256x256/apps/${pkgname}.png
+
+ install -Dm755 "${srcdir}"/${pkgname}.js "${pkgdir}"/usr/bin/${pkgname}
+ install -Dm644 "${srcdir}"/${pkgname}.desktop \
+ "${pkgdir}"/usr/share/applications/${pkgname}.desktop
+
+ # Clean up
+ rm "${pkgdir}"${appdir}/dist/build.js
+ rm -r "${pkgdir}"${appdir}/icons
+ rm -r "${pkgdir}"${appdir}/localization
+ rm -r "${pkgdir}"${appdir}/main
+ rm -r "${pkgdir}"${appdir}/scripts
+ find "${pkgdir}"${appdir} \
+ -name "package.json" \
+ -exec sed -e "s|${srcdir}/${pkgname}-${pkgver}|${appdir}|" \
+ -i {} \; \
+ -or -name ".*" -prune -exec rm -r '{}' \; \
+ -or -name "Gruntfile.js" -exec rm '{}' \; \
+ -or -name "Makefile" -exec rm '{}' \; \
+ -or -name "bin" -prune -exec rm -r '{}' \; \
+ -or -name "bin.js" -exec rm '{}' \; \
+ -or -name "bower.json" -exec rm '{}' \; \
+ -or -name "cli.js" -exec rm '{}' \; \
+ -or -name "cmd.js" -exec rm '{}' \; \
+ -or -name "coffee" -prune -exec rm -r '{}' \; \
+ -or -name "example" -prune -exec rm -r '{}' \; \
+ -or -name "examples" -prune -exec rm -r '{}' \; \
+ -or -name "gulpfile.js" -exec rm '{}' \; \
+ -or -name "man" -prune -exec rm -r '{}' \; \
+ -or -name "scripts" -prune -exec rm -r '{}' \; \
+ -or -name "test" -prune -exec rm -r '{}' \; \
+ -or -name "tests" -prune -exec rm -r '{}' \;
+}
diff --git a/nonfree/min/icon.patch b/nonfree/min/icon.patch
new file mode 100644
index 000000000..dd8194718
--- /dev/null
+++ b/nonfree/min/icon.patch
@@ -0,0 +1,10 @@
+--- a/main/main.js
++++ b/main/main.js
+@@ -83,7 +83,6 @@
+ minWidth: 320,
+ minHeight: 350,
+ titleBarStyle: 'hiddenInset',
+- icon: __dirname + '/icons/icon256.png',
+ frame: process.platform !== 'win32',
+ backgroundColor: '#fff', // the value of this is ignored, but setting it seems to work around https://github.com/electron/electron/issues/10559
+ })
diff --git a/nonfree/min/min.desktop b/nonfree/min/min.desktop
new file mode 100644
index 000000000..dbf9ca61f
--- /dev/null
+++ b/nonfree/min/min.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Type=Application
+Name=Min
+GenericName=Web Browser
+Comment=A smarter, faster web browser
+Icon=min
+Exec=min
+Categories=GTK;Network;WebBrowser;
+StartupNotify=true
diff --git a/nonfree/min/min.js b/nonfree/min/min.js
new file mode 100644
index 000000000..e3bfeba0f
--- /dev/null
+++ b/nonfree/min/min.js
@@ -0,0 +1,29 @@
+#!/usr/bin/electron
+
+const name = 'min';
+
+const {app} = require('electron');
+const fs = require('fs');
+const path = require('path');
+
+// Change command name.
+const fd = fs.openSync('/proc/self/comm', fs.constants.O_WRONLY);
+fs.writeSync(fd, name);
+fs.closeSync(fd);
+
+// Remove first command line argument (/usr/bin/electron).
+process.argv.splice(0, 1);
+
+// Set application paths.
+const appPath = path.join(path.dirname(__dirname), 'lib', name);
+const packageJson = require(path.join(appPath, 'package.json'));
+const productName = packageJson.productName;
+app.setAppPath(appPath);
+app.setDesktopName(name + '.desktop');
+app.setName(productName);
+app.setPath('userCache', path.join(app.getPath('cache'), productName));
+app.setPath('userData', path.join(app.getPath('appData'), productName));
+app.setVersion(packageJson.version);
+
+// Run the application.
+require('module')._load(appPath, module, true);
diff --git a/nonfree/min/remove_nonprivacy_options.patch b/nonfree/min/remove_nonprivacy_options.patch
new file mode 100644
index 000000000..76aedd419
--- /dev/null
+++ b/nonfree/min/remove_nonprivacy_options.patch
@@ -0,0 +1,107 @@
+diff --git a/js/searchbar/bangsPlugin.js b/js/searchbar/bangsPlugin.js
+index 176c3c8f5..016c11229 100644
+--- a/js/searchbar/bangsPlugin.js
++++ b/js/searchbar/bangsPlugin.js
+@@ -105,7 +105,18 @@ function showBangSearchResults (results, input, event, container) {
+ function getBangSearchResults (text, input, event, container) {
+
+ // get results from DuckDuckGo if it is a search engine, and the current tab is not a private tab
+- if (currentSearchEngine.name === 'DuckDuckGo' && !tabs.get(tabs.getSelected()).private) {
++ if (currentSearchEngine.name === 'DuckDuckGo HTML' && !tabs.get(tabs.getSelected()).private) {
++ fetch('https://ac.duckduckgo.com/ac/?t=min&q=' + encodeURIComponent(text), {
++ cache: 'force-cache'
++ })
++ .then(function (response) {
++ return response.json()
++ })
++ .then(function (results) {
++ // show the DuckDuckGo results, combined with the custom !bangs
++ showBangSearchResults(results.concat(searchCustomBangs(text)), input, event, container)
++ })
++ } else if (currentSearchEngine.name === 'DuckDuckGo Lite' && !tabs.get(tabs.getSelected()).private) {
+ fetch('https://ac.duckduckgo.com/ac/?t=min&q=' + encodeURIComponent(text), {
+ cache: 'force-cache'
+ })
+diff --git a/js/searchbar/instantAnswerPlugin.js b/js/searchbar/instantAnswerPlugin.js
+index 22ab0da84..ea385692d 100644
+--- a/js/searchbar/instantAnswerPlugin.js
++++ b/js/searchbar/instantAnswerPlugin.js
+@@ -1,6 +1,8 @@
+ function showSearchbarInstantAnswers (text, input, event, container) {
+ // only make requests to the DDG api if DDG is set as the search engine
+- if (currentSearchEngine.name !== 'DuckDuckGo') {
++ if (currentSearchEngine.name !== 'DuckDuckGo HTML') {
++ return
++ } else if (currentSearchEngine.name !== 'DuckDuckGo Lite') {
+ return
+ }
+
+diff --git a/js/searchbar/searchSuggestionsPlugin.js b/js/searchbar/searchSuggestionsPlugin.js
+index 7c3dc5e91..fcd2d544c 100644
+--- a/js/searchbar/searchSuggestionsPlugin.js
++++ b/js/searchbar/searchSuggestionsPlugin.js
+@@ -2,7 +2,9 @@ var ddgAttribution = 'Results from DuckDuckGo'
+
+ function showSearchSuggestions (text, input, event, container) {
+ // TODO support search suggestions for other search engines
+- if (currentSearchEngine.name !== 'DuckDuckGo') {
++ if (currentSearchEngine.name !== 'DuckDuckGo HTML') {
++ return
++ } else if (currentSearchEngine.name !== 'DuckDuckGo Lite') {
+ return
+ }
+
+diff --git a/js/util/searchEngine.js b/js/util/searchEngine.js
+index 18ff46e20..1c41b7ec8 100644
+--- a/js/util/searchEngine.js
++++ b/js/util/searchEngine.js
+@@ -3,28 +3,20 @@ var currentSearchEngine = {
+ searchURL: '%s'
+ }
+
+-var defaultSearchEngine = 'DuckDuckGo'
++var defaultSearchEngine = 'DuckDuckGoHTML'
+
+ var searchEngines = {
+- DuckDuckGo: {
+- name: 'DuckDuckGo',
+- searchURL: 'https://duckduckgo.com/?q=%s&t=min'
++ DuckDuckGoHTML: {
++ name: 'DuckDuckGo HTML',
++ searchURL: 'https://duckduckgo.com/html/?q=%s&t=min'
+ },
+- Google: {
+- name: 'Google',
+- searchURL: 'https://google.com/search?q=%s'
++ DuckDuckGoLite: {
++ name: 'DuckDuckGo Lite',
++ searchURL: 'https://duckduckgo.com/lite/?q=%s&t=min'
+ },
+- Bing: {
+- name: 'Bing',
+- searchURL: 'https://www.bing.com/search?q=%s'
+- },
+- Yahoo: {
+- name: 'Yahoo',
+- searchURL: 'https://search.yahoo.com/yhs/search?p=%s'
+- },
+- Baidu: {
+- name: 'Baidu',
+- searchURL: 'https://www.baidu.com/s?wd=%s'
++ searx: {
++ name: 'searx',
++ searchURL: 'https://searx.laquadrature.net/search?q=%s'
+ },
+ StartPage: {
+ name: 'StartPage',
+@@ -34,10 +26,6 @@ var searchEngines = {
+ name: 'Wikipedia',
+ searchURL: 'https://wikipedia.org/w/index.php?search=%s'
+ },
+- Yandex: {
+- name: 'Yandex',
+- searchURL: 'https://yandex.com/search/?text=%s'
+- },
+ none: {
+ name: 'none',
+ searchURL: 'http://%s'