🗝
summary refs log tree commit diff
path: root/misc
diff options
context:
space:
mode:
authormia <mia@mia.jetzt>2024-06-08 22:56:05 -0700
committermia <mia@mia.jetzt>2024-06-08 22:56:05 -0700
commit8cf813ff033bbc98a7dd40db6ac11e2e35c7e997 (patch)
treea451059194cbd4ba90993ebdaced4749448ec4df /misc
downloadasylum-8cf813ff033bbc98a7dd40db6ac11e2e35c7e997.tar.gz
asylum-8cf813ff033bbc98a7dd40db6ac11e2e35c7e997.zip
initial commit
Diffstat (limited to 'misc')
-rw-r--r--misc/searxng.py28
-rw-r--r--misc/searxng.yml44
2 files changed, 72 insertions, 0 deletions
diff --git a/misc/searxng.py b/misc/searxng.py
new file mode 100644
index 0000000..db56c21
--- /dev/null
+++ b/misc/searxng.py
@@ -0,0 +1,28 @@
+import random
+import string
+
+from commia.bearer import get_key, has_key, keys, set_key
+from commia.prelude import *
+from commia.ssh import ssh_args, ssh_opt_args, ssh_prewarm
+from commia.util import with_written
+
+ssh_prewarm("asylum", "secrets@bearer")
+
+if not has_key(keys.searxng.secret_key):
+    print("initializing secret key")
+    key = ""
+    for _ in range(64):
+        key += random.choice(string.ascii_letters + string.digits + "-_=+")
+    set_key(keys.searxng.secret_key, key)
+
+secret_key = get_key(keys.searxng.secret_key)
+searxng_conf = Path("misc/searxng.yml").read_text().replace("%SECRET_KEY%", secret_key)
+
+with_written(
+    searxng_conf,
+    lambda path: run_sc(
+        ["scp", *ssh_opt_args(), path, "asylum:/etc/searxng/settings.yml"]
+    ),
+)
+
+run_check(p([*ssh_args(), "systemctl", "restart", "searxng"]))
diff --git a/misc/searxng.yml b/misc/searxng.yml
new file mode 100644
index 0000000..cd3bea0
--- /dev/null
+++ b/misc/searxng.yml
@@ -0,0 +1,44 @@
+general:
+  instance_name: search.mia.jetzt
+
+search:
+  safe_search: 1
+  autocomplete: duckduckgo
+
+server:
+  base_url: https://search.mia.jetzt/
+  secret_key: "%SECRET_KEY%"
+  image_proxy: true
+  method: GET
+
+ui:
+  static_use_hash: true
+
+doi_resolvers:
+  oadoi.org: https://oadoi.org/
+
+default_doi_resolver: oadoi.org
+
+engines:
+  # autocomplete
+  - name: duckduckgo
+    engine: duckduckgo
+    disabled: true
+
+  # general
+  - name: bing
+    engine: bing
+    shortcut: bi
+
+  - name: google
+    engine: google
+    shortcut: go
+
+  # image
+  - name: bing images
+    engine: bing_images
+    shortcut: bii
+
+  - name: google images
+    engine: google_images
+    shortcut: goi