From dafc1eadff47e7838c4275363b6f7f027a160bd1 Mon Sep 17 00:00:00 2001 From: Jon Lawrence Date: Mon, 3 Mar 2025 14:52:37 -0800 Subject: [PATCH 1/4] Added docker Added a Dockerfile and compose.yaml for easy deployment via docker. Updated README to provide clear instruction on how to get the instance running. --- Dockerfile-jank | 18 ++++++++++++++++++ README.md | 4 ++-- compose.yaml | 8 ++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 Dockerfile-jank create mode 100644 compose.yaml diff --git a/Dockerfile-jank b/Dockerfile-jank new file mode 100644 index 0000000..a004369 --- /dev/null +++ b/Dockerfile-jank @@ -0,0 +1,18 @@ +From node:18-bullseye as builder + +WORKDIR devel/ +RUN apt-get update ; apt-get upgrade -y ; apt-get install -y python-is-python3 build-essential git +RUN git clone https://github.com/MathMan05/JankClient +RUN cd JankClient ; npm i ; npm run build + +From node:18-alpine + +EXPOSE 8080 +WORKDIR exec +RUN apk add --update git nodejs npm +COPY --from=builder /devel/JankClient/ . +RUN adduser -D jankclient + +USER jankclient + +CMD ["npm", "start"] diff --git a/README.md b/README.md index af4289e..365441c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Jank Client Jank Client is a [Spacebar](https://spacebar.chat) Client written in TS, HTML, and CSS. -To run it, clone the repo and do `npm install`, then -`node index.js` +To build it, clone the repo and run `npm install`, then `npm run build` +To run it, use `npm start` or do the equivalent with bun Both [Bun](https://bun.sh) and [Node.js](https://nodejs.org) are supported, and should function as expected. diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..f93d94a --- /dev/null +++ b/compose.yaml @@ -0,0 +1,8 @@ +services: + jank: + build: + context: . + dockerfile: Dockerfile-jank + restart: unless-stopped + ports: + - "8080:8080" From 58590a56ea8796428786bc6f59af1b290f1c513c Mon Sep 17 00:00:00 2001 From: Jon Lawrence Date: Fri, 7 Mar 2025 14:07:14 -0800 Subject: [PATCH 2/4] Dockerfile now named correctly Dockerfile is now named correctly, and pulls from the local repository/directory instead of pulling the image from github. --- Dockerfile | 18 ++++++++++++++++++ Dockerfile-jank | 18 ------------------ compose.yaml | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 Dockerfile delete mode 100644 Dockerfile-jank diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6676f2d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM node:18-bullseye AS builder + +WORKDIR /devel +RUN apt-get update ; apt-get upgrade -y ; apt-get install -y build-essential +COPY . . +RUN npm i ; npm run build + +FROM node:18-alpine + +EXPOSE 8080 +WORKDIR /exec +RUN apk add --update nodejs npm +COPY --from=builder /devel/ . +RUN adduser -D jankclient + +USER jankclient + +CMD ["npm", "start"] diff --git a/Dockerfile-jank b/Dockerfile-jank deleted file mode 100644 index a004369..0000000 --- a/Dockerfile-jank +++ /dev/null @@ -1,18 +0,0 @@ -From node:18-bullseye as builder - -WORKDIR devel/ -RUN apt-get update ; apt-get upgrade -y ; apt-get install -y python-is-python3 build-essential git -RUN git clone https://github.com/MathMan05/JankClient -RUN cd JankClient ; npm i ; npm run build - -From node:18-alpine - -EXPOSE 8080 -WORKDIR exec -RUN apk add --update git nodejs npm -COPY --from=builder /devel/JankClient/ . -RUN adduser -D jankclient - -USER jankclient - -CMD ["npm", "start"] diff --git a/compose.yaml b/compose.yaml index f93d94a..ba6944f 100644 --- a/compose.yaml +++ b/compose.yaml @@ -2,7 +2,7 @@ services: jank: build: context: . - dockerfile: Dockerfile-jank + dockerfile: Dockerfile restart: unless-stopped ports: - "8080:8080" From a41d17c507b42672b5f0415ee1d153ae89864680 Mon Sep 17 00:00:00 2001 From: Jon Lawrence Date: Sat, 8 Mar 2025 00:00:51 +0000 Subject: [PATCH 3/4] Create docker-image.yml --- .github/workflows/docker-image.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..3f53646 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,18 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Build the Docker image + run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) From 76caa43276ab216b5d56aaaa0d1bb695c580c338 Mon Sep 17 00:00:00 2001 From: Jon Lawrence Date: Fri, 7 Mar 2025 16:46:18 -0800 Subject: [PATCH 4/4] Color picker on member page The color picker on the member page now shows the currently selected user color on load. --- src/webpage/member.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/webpage/member.ts b/src/webpage/member.ts index 4acbdea..7997847 100644 --- a/src/webpage/member.ts +++ b/src/webpage/member.ts @@ -290,12 +290,8 @@ class Member extends SnowFlake { hypomember.bio = _; regen(); }); - return; //Returns early to stop errors - if (this.accent_color) { - color = "#" + this.accent_color.toString(16); - } else { - color = "transparent"; - } + color = (this.accent_color ? "#" + this.accent_color.toString(16) : "transparent") as string; + const colorPicker = settingsLeft.addColorInput( I18n.getTranslation("profileColor"), (_) => {}, @@ -304,7 +300,7 @@ class Member extends SnowFlake { colorPicker.watchForChange((_) => { console.log(); color = _; - hypomember.accent_color = Number.parseInt("0x" + _.substr(1), 16); + hypomember.accent_color = Number.parseInt("0x" + _.substr(1, 16)); changed = true; regen(); });