mirror of
https://github.com/Nystik-gh/ignis.git
synced 2026-06-17 04:35:53 +00:00
fix os.version shim, improve docker image
This commit is contained in:
37
scripts/entrypoint.sh
Normal file
37
scripts/entrypoint.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
OBSIDIAN_DIR="/app/obsidian-app"
|
||||
OBSIDIAN_VERSION="${OBSIDIAN_VERSION:-1.12.4}"
|
||||
|
||||
if [ ! -f "$OBSIDIAN_DIR/index.html" ]; then
|
||||
echo "[ignis] First run. Downloading Obsidian v${OBSIDIAN_VERSION}..."
|
||||
|
||||
curl -fSL "https://github.com/obsidianmd/obsidian-releases/releases/download/v${OBSIDIAN_VERSION}/obsidian_${OBSIDIAN_VERSION}_amd64.deb" \
|
||||
-o /tmp/obsidian.deb
|
||||
|
||||
echo "[ignis] Extracting .deb..."
|
||||
mkdir -p /tmp/obsidian-deb /tmp/obsidian-pkg
|
||||
ar x /tmp/obsidian.deb --output=/tmp/obsidian-deb
|
||||
tar -xf /tmp/obsidian-deb/data.tar.xz -C /tmp/obsidian-pkg
|
||||
|
||||
echo "[ignis] Unpacking asar..."
|
||||
npx --yes @electron/asar extract \
|
||||
/tmp/obsidian-pkg/opt/Obsidian/resources/obsidian.asar \
|
||||
"$OBSIDIAN_DIR"
|
||||
|
||||
echo "[ignis] Patching..."
|
||||
node /app/scripts/patch-obsidian.js "$OBSIDIAN_DIR"
|
||||
|
||||
cp /app/dist/shim-loader.js "$OBSIDIAN_DIR/shim-loader.js"
|
||||
cp /app/images/favicon.png "$OBSIDIAN_DIR/favicon.png"
|
||||
|
||||
|
||||
rm -rf /tmp/obsidian.deb /tmp/obsidian-deb /tmp/obsidian-pkg
|
||||
|
||||
echo "[ignis] Obsidian v${OBSIDIAN_VERSION} ready."
|
||||
else
|
||||
echo "[ignis] Obsidian already set up."
|
||||
fi
|
||||
|
||||
exec node /app/server/index.js
|
||||
@@ -2,6 +2,7 @@
|
||||
// Patches the extracted Obsidian asar for browser use:
|
||||
// 1. Removes Content-Security-Policy meta tag
|
||||
// 2. Injects shim-loader.js script (non-deferred, before all other scripts)
|
||||
// 3. Injects favicon link
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
@@ -26,6 +27,12 @@ function patchHtml(filePath) {
|
||||
"\n",
|
||||
);
|
||||
|
||||
// Inject favicon into <head>
|
||||
html = html.replace(
|
||||
"</head>",
|
||||
' <link rel="icon" type="image/png" href="favicon.png">\n</head>',
|
||||
);
|
||||
|
||||
// Inject shim-loader before the first <script> tag
|
||||
html = html.replace(
|
||||
'<script type="text/javascript"',
|
||||
|
||||
Reference in New Issue
Block a user