Compare commits

...

5 commits

5 changed files with 146 additions and 0 deletions

6
build-image.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
[ -z "$1" ] && exit 1
docker build $1 -t gitea.angry.im/petercxy/$1:latest
docker push gitea.angry.im/petercxy/$1:latest

19
element-web/Dockerfile Normal file
View file

@ -0,0 +1,19 @@
ARG ELEMENT_VER=v1.11.10
FROM debian:11 AS builder
ARG ELEMENT_VER
RUN apt-get update && apt-get install -y nodejs curl git
ADD custom_config.js /
RUN cd / && curl -k -L "https://raw.githubusercontent.com/vector-im/element-web/${ELEMENT_VER}/config.sample.json" > config.sample.json \
&& git clone --depth=1 https://github.com/aaronraimist/element-themes \
&& node custom_config.js | tee config.json
FROM vectorim/element-web:${ELEMENT_VER}
ARG ELEMENT_VER
COPY --from=builder /config.json /app/config.json

View file

@ -0,0 +1,82 @@
#!/usr/bin/node
const child_process = require('child_process');
const fs = require('fs');
config = require("./config.sample.json");
config["default_server_config"]["m.homeserver"] = {
"base_url": "https://neo.angry.im",
"server_name": "neo.angry.im"
};
config["integrations_ui_url"] = "https://dimension.angry.im/element";
config["integrations_rest_url"] = "https://dimension.angry.im/api/v1/scalar";
config["integrations_widgets_urls"] = ["https://dimension.angry.im/widgets"];
config["room_directory"]["servers"] = [ "matrix.org", "neo.angry.im", "mozilla.modular.im", "feneas.org", "chat.privacytools.io" ];
config["enable_presence_by_hs_url"] = {
"https://matrix.org": false,
"https://matrix-client.matrix.org": false,
"https://neo.angry.im": false
};
config["cross_origin_renderer_url"] = "https://riotcontent.angry.im/v1.html";
config["features"]["feature_custom_themes"] = "labs";
config["show_labs_settings"] = true;
// Themes
config["setting_defaults"]["custom_themes"] = [];
const theme_files = child_process.execSync("find element-themes -name '*.json'").toString().split("\n");
for (const file of theme_files) {
if (file === "") continue;
try {
const data = JSON.parse(fs.readFileSync(file));
config["setting_defaults"]["custom_themes"].push(data);
} catch (err) {
// Nothing
}
}
// my custom themes
config["setting_defaults"]["custom_themes"].push(
{
"name": "Gruvbox Dark",
"is_dark": true,
"colors": {
"accent-color": "#ebdbb2",
"primary-color": "#ebdbb2",
"warning-color": "#fb4934",
"sidebar-color": "#3c3836",
"roomlist-background-color": "#282828",
"roomlist-text-color": "#ebdbb2",
"roomlist-text-secondary-color": "#d5c4a1",
"roomlist-highlights-color": "#665c54",
"roomlist-separator-color": "#504945",
"timeline-background-color": "#282828",
"timeline-text-color": "#ebdbb2",
"secondary-content": "#d5c4a1",
"tertiary-content": "#bdae93",
"timeline-text-secondary-color": "#d5c4a1",
"timeline-highlights-color": "#665c54",
"reaction-row-button-selected-bg-color": "#bdae93",
"username-colors": [
"#fb4934",
"#b8bb26",
"#fabd2f",
"#83a598",
"#d3869b",
"#8ec07c",
"#fe8019",
"#ebdbb2"
],
"avatar-background-colors": [
"#d3869b",
"#8ec07c",
"#83a598"
]
}
}
);
delete config["piwik"]
console.log(JSON.stringify(config, null, 4))

View file

@ -0,0 +1,32 @@
FROM node:16-alpine AS builder
ARG SN_TAG=@standardnotes/web@3.72.4
RUN apk add git
RUN git clone --depth=1 https://github.com/standardnotes/app -b ${SN_TAG}
RUN cd app && yarn install && yarn build:web
FROM joseluisq/static-web-server:2-alpine
ENV SN_WEB_PUBLIC_URL=https://app.standardnotes.com
ENV SN_WEB_DEFAULT_SYNC_SERVER=https://api.standardnotes.com
ENV SN_WEB_DEFAULT_FILES_HOST=https://files.standardnotes.com
COPY --from=builder /app/packages/web/dist /public
COPY start.sh /
RUN chmod +x /start.sh
# Disable cache-control headers sent by the container
ENV SERVER_CACHE_CONTROL_HEADERS=false
CMD [ "/start.sh" ]
LABEL org.opencontainers.image.vendor="Standard Notes" \
org.opencontainers.image.url="https://github.com/standardnotes" \
org.opencontainers.image.title="Standard Notes Web App" \
org.opencontainers.image.description="An encrypted note-taking app" \
org.opencontainers.image.version="${SN_TAG}" \
org.opencontainers.image.documentation="https://github.com/standardnotes"

View file

@ -0,0 +1,7 @@
#!/bin/sh
sed -i "s@https://app.standardnotes.com@${SN_WEB_PUBLIC_URL}@g" /public/index.html
sed -i "s@https://api.standardnotes.com@${SN_WEB_DEFAULT_SYNC_SERVER}@g" /public/index.html
sed -i "s@https://files.standardnotes.com@${SN_WEB_DEFAULT_FILES_HOST}@g" /public/index.html
exec static-web-server