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) 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/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..ba6944f --- /dev/null +++ b/compose.yaml @@ -0,0 +1,8 @@ +services: + jank: + build: + context: . + dockerfile: Dockerfile + restart: unless-stopped + ports: + - "8080:8080" 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(); });