mirror of
https://github.com/TriliumNext/Notes.git
synced 2026-03-09 07:49:42 -05:00
docs: Move binaries to bin/
This commit is contained in:
1
bin/docs/.env.example
Normal file
1
bin/docs/.env.example
Normal file
@@ -0,0 +1 @@
|
||||
SHARE_URL=https://notes.example.com/share/4yYHqKbLovVY
|
||||
2
bin/docs/.gitignore
vendored
Normal file
2
bin/docs/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
output
|
||||
.env
|
||||
10
bin/docs/index.template.html
Normal file
10
bin/docs/index.template.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; url=./{{ROOT_NOTE_ID}}.html" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
34
bin/docs/prepare.sh
Executable file
34
bin/docs/prepare.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ ! -f .env ]; then
|
||||
echo "Missing .env file, cannot proceed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
script_dir=$(realpath $(dirname $0))
|
||||
output_dir="$script_dir/../docs"
|
||||
mkdir -p "$output_dir"
|
||||
rm -f "$output_dir"/*
|
||||
rm -rf "$output_dir"/{assets,share}
|
||||
|
||||
source ./.env
|
||||
|
||||
# Download everything in output/notes.example.com/share/...
|
||||
share_url="$SHARE_PROTOCOL://$SHARE_HOST/share/$ROOT_NOTE_ID"
|
||||
wget -rpEk -e robots=off "$share_url" -P "$output_dir"
|
||||
|
||||
# Get rid of the domain in the output folder
|
||||
mv "$output_dir/$SHARE_HOST"/* "$output_dir/"
|
||||
rmdir "$output_dir/$SHARE_HOST"
|
||||
|
||||
# Create home page with redirect
|
||||
index_dest_path="$output_dir/index.html"
|
||||
cp index.template.html "$index_dest_path"
|
||||
sed -i "s/{{ROOT_NOTE_ID}}/$ROOT_NOTE_ID/g" "$index_dest_path"
|
||||
|
||||
# Rewrite links to get rid of the share folder
|
||||
sed -i "s/<link href=\"\\.\\./<link href=\"\\./g" "$output_dir/share"/*.html
|
||||
sed -i "s/<script src=\"\\.\\./<script src=\"\\./g" "$output_dir/share"/*.html
|
||||
sed -i "s/rel=\"shortcut icon\" href=\"\\.\\./rel=\"shortcut icon\" href=\"\\./g" "$output_dir/share"/*.html
|
||||
mv "$output_dir/share"/* "$output_dir"
|
||||
rmdir "$output_dir/share"
|
||||
5
bin/docs/preview.sh
Executable file
5
bin/docs/preview.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
script_dir=$(realpath $(dirname $0))
|
||||
output_dir="$script_dir/../docs"
|
||||
httpd -fv -p 127.0.0.1:8089 -h "$output_dir"
|
||||
Reference in New Issue
Block a user