Merge pull request #17 from notclickable-jordan/undo-snapshot

Revert "Merge pull request #16 from notclickable-jordan/snapshot"
This commit is contained in:
Jordan Roher 2023-12-14 16:17:43 -08:00 committed by GitHub
commit 2000c8080b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 366 additions and 1821 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
node_modules node_modules
.DS_Store .DS_Store
dist dist
dist-ssr dist-ssr
public

48
config.json.sample Normal file
View File

@ -0,0 +1,48 @@
[
{
"category": "Services",
"services": [
{
"name": "Archivebox",
"uri": "https://archivebox.mywebsite.com",
"description": "Backup webpages",
"icon": "/icons/archivebox.jpg"
},
{
"name": "Authelia",
"uri": "https://auth.mywebsite.com",
"description": "Authentication",
"icon": "/icons/authelia.png"
},
{
"name": "Calibre",
"uri": "https://calibre.mywebsite.com",
"description": "eBook library",
"icon": "/icons/calibre.png"
}
]
},
{
"category": "Devices",
"services": [
{
"name": "Router",
"uri": "http://192.168.1.1/",
"description": "Netgear Orbi",
"icon": "/icons/router.png"
},
{
"name": "Home Assistant",
"uri": "http://homeassistant.local:8123/",
"description": "Home automation",
"icon": "/icons/home-assistant.svg"
},
{
"name": "Synology",
"uri": "http://synology:5000",
"description": "Network storage",
"icon": "/icons/synology.png"
}
]
}
]

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# Escape slashes # Escape slashes
LOGO=$(echo "${LOGO}" | sed 's/\//\\\//g') LOGO=${LOGO//\//\\/}
# HTML replacement # HTML replacement
sed -i -e 's/My Website/'"${TITLE}"'/g' /app/index.html sed -i -e 's/My Website/'"${TITLE}"'/g' /app/index.html

View File

@ -1,23 +1,4 @@
# Build site using Node JS FROM node:18-alpine
FROM node:21-slim
# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
# installs, work.
RUN apt-get update \
&& apt-get install -y wget gnupg \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y chromium fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
ENV PUPPETEER_SKIP_DOWNLOAD true
# Install puppeteer so it's available in the container.
RUN npm init -y && \
npm i -g puppeteer
ARG BUILD_DATE ARG BUILD_DATE
@ -48,6 +29,7 @@ ENV BGCOLORDARK "theme(colors.gray.950)"
ENV NEWWINDOW "true" ENV NEWWINDOW "true"
COPY version / COPY version /
EXPOSE 4173 EXPOSE 4173
RUN chmod +x /app/docker-entrypoint.sh RUN chmod +x /app/docker-entrypoint.sh

2001
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,39 +1,32 @@
{ {
"name": "starbase-80", "name": "starbase-80",
"displayName": "Starbase 80", "displayName": "Starbase 80",
"homepage": "https://www.starbase80.dev/", "homepage": "https://github.com/notclickable-jordan/starbase-80",
"repository": { "repository": {
"url": "https://github.com/notclickable-jordan/starbase-80/" "url": "https://github.com/notclickable-jordan/starbase-80"
}, },
"version": "1.3.0", "version": "1.1.5",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "tsc && vite build", "build": "tsc && vite build",
"serve": "vite preview", "start": "npm run build && vite preview"
"start": "node start.js",
"html": "html-minifier --remove-comments --collapse-whitespace --input-dir ./dist --output-dir ./dist --file-ext html",
"replace": "npm run replace:script",
"replace:script": "replace-in-file --configFile replace-script.cjs"
}, },
"dependencies": { "dependencies": {
"@types/react": "^18.2.45", "@types/react-dom": "^18.2.7",
"@types/react-dom": "^18.2.17", "@types/react-helmet": "^6.1.6",
"@types/react-helmet": "^6.1.11", "@types/react": "^18.2.15",
"@vitejs/plugin-react": "^4.2.1", "@vitejs/plugin-react": "^4.0.3",
"autoprefixer": "^10.4.16", "autoprefixer": "^10.4.14",
"html-minifier": "^4.0.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"postcss": "^8.4.32", "postcss": "^8.4.26",
"prettier": "^3.1.1", "prettier": "^3.0.0",
"puppeteer": "^21.6.1",
"react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-helmet": "^6.1.0", "react-helmet": "^6.1.0",
"replace-in-file": "^7.0.2", "react": "^18.2.0",
"tailwindcss": "^3.3.6", "tailwindcss": "^3.3.3",
"typescript": "^5.3.3", "typescript": "^5.1.6",
"vite": "^5.0.8" "vite": "^4.4.4"
}, },
"prettier": { "prettier": {
"arrowParens": "avoid", "arrowParens": "avoid",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@ -32,10 +32,6 @@ Inspired by [Ben Phelps' Homepage](https://gethomepage.dev/) and [Umbrel](https:
# Change history # Change history
## 1.3.0
- Removed all JavaScript as part of the build step. The image will be slightly larger and take longer to start up and shut down, but the page will be even lighter.
## 1.2.0 ## 1.2.0
- Moved `config.json` bind mount destination to `/app/src/config/config.json` for improved Portainer and volume support. The previous bind mount location will continue to work, but we recommend updating your bind mounts. - Moved `config.json` bind mount destination to `/app/src/config/config.json` for improved Portainer and volume support. The previous bind mount location will continue to work, but we recommend updating your bind mounts.

View File

@ -1,5 +0,0 @@
module.exports = {
files: "./dist/index.html",
from: /<script[^>]+><\/script>/gi,
to: "",
};

View File

@ -11,7 +11,7 @@
{ {
"name": "Bind mount", "name": "Bind mount",
"uri": "https://github.com/notclickable-jordan/docker-symphony", "uri": "https://github.com/notclickable-jordan/docker-symphony",
"description": "/app/src/config/config.json", "description": "to /app/src/config/config.json",
"icon": "docker" "icon": "docker"
}, },
{ {

View File

@ -1,61 +0,0 @@
import { exec } from "child_process";
import fs from "fs/promises";
import puppeteer from "puppeteer";
function runNpmCommand(command) {
return new Promise((resolve, reject) => {
exec(`npm ${command}`, (error, stdout, stderr) => {
if (error) {
console.error(`Error executing command: ${error}`);
reject(error);
} else {
console.log(`Command output: ${stdout}`);
resolve(stdout);
}
});
});
}
async function renderHomePage() {
const browser = await puppeteer.launch({
headless: true,
args: ["--no-sandbox", "--disable-setuid-sandbox"],
executablePath: "chromium", // Remove this when running locally
});
const page = await browser.newPage();
await page.goto("http://localhost:4173", { waitUntil: "networkidle0" });
// Wait for any additional content to load
await page.waitForNetworkIdle();
// Get the rendered HTML content
const renderedHTML = await page.content();
// Save the rendered HTML to a file
fs.writeFile("./dist/index.html", renderedHTML);
await browser.close();
}
async function runCommands() {
try {
console.log("Building React site");
await runNpmCommand("run build");
setTimeout(async () => {
console.log("Taking snapshot");
await renderHomePage();
await runNpmCommand("run html");
await runNpmCommand("run replace");
}, 2000);
console.log("Starting web server");
await runNpmCommand("run serve");
} catch (err) {
// Handle errors
console.error("An error occurred:", err);
}
}
runCommands();

View File

@ -1 +1 @@
1.3.0 1.2.0