File tree Expand file tree Collapse file tree 2 files changed +68
-0
lines changed Expand file tree Collapse file tree 2 files changed +68
-0
lines changed Original file line number Diff line number Diff line change 1+ ## Each line in a marktab file represents a rule.
2+ ## A rule consists of three fields: trigger, pattern, and command.
3+ ## The syntax for each line is as follows:
4+ ##
5+ ## # * * *
6+ ## # | | |_____ shell command to execute
7+ ## # | |_________ pattern to match on the url or title
8+ ## # |____________ trigger keyword to detect in tags
9+
10+ # ArchiveBox integration, any bookmark saved with the tag or folder named
11+ # @archivebox will call the archivebox script to archive the page
12+ # Uncomment the following line to enable ArchiveBox integration
13+ #@archivebox .* ~/.local/share/gosuki/archivebox
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env sh
2+ # Script to add a URL to ArchiveBox via SSH using Docker Compose
3+ #
4+ # This script connects to a remote ArchiveBox host via SSH and executes a Docker
5+ # Compose command to add a URL to ArchiveBox with specified tags. The script is
6+ # designed for Docker-based ArchiveBox installations that are accessible through
7+ # SSH and managed via Docker Compose.
8+ #
9+ # Environment Variables:
10+ # GOSUKI_TAGS - Tags to apply to the archived URL (inherited from environment)
11+ # GOSUKI_URL - The URL to be archived (inherited from environment)
12+ # HOST - The remote host to connect to via SSH
13+ #
14+ # Configuration:
15+ # COMPOSE_WORKDIR - Docker Compose project directory on the remote host
16+ # ADD_URL_CMD - Docker Compose command to add the URL with tags
17+ #
18+ # Output:
19+ # Logs are appended to ~/.local/share/gosuki/archivebox.log
20+
21+ set -euo pipefail
22+
23+ # Ensure required variables are set
24+ : " ${GOSUKI_URL?GOSUKI_URL must be set} "
25+ : " ${GOSUKI_TAGS?GOSUKI_TAGS must be set} "
26+
27+
28+
29+ XDG_DATA_HOME=${XDG_DATA_HOME:- $HOME / .local/ share/ gosuki}
30+
31+ LOG_FILE=$XDG_DATA_HOME /gosuki/archivebox.log
32+
33+ HOST=" TARGET_HOST"
34+ SSH_CMD=" ssh $HOST "
35+ COMPOSE_WORKDIR=" ~/docker/docker_files/archivebox"
36+ ADD_URL_CMD=" run --rm --remove-orphans -T archivebox add --update-all --tag $GOSUKI_TAGS $GOSUKI_URL "
37+ DOCKER_ARGS=(
38+ run
39+ --rm
40+ --remove-orphans
41+ -T
42+ archivebox
43+ add
44+ --update-all
45+ --tag " $GOSUKI_TAGS "
46+ " $GOSUKI_URL "
47+ )
48+
49+ echo " ID=$GOSUKI_RUN_ID " Archiving $GOSUKI_URL >> " $LOG_FILE "
50+
51+
52+ if ! $SSH_CMD " cd $COMPOSE_WORKDIR && docker compose ${DOCKER_ARGS[*]} " 2>> " $LOG_FILE " ; then
53+ echo " Error: Failed to archive URL" >&2
54+ exit 1
55+ fi
You can’t perform that action at this time.
0 commit comments