Skip to content

Commit

Permalink
Merge branch 'master' into chore/hi-translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Elsie19 authored Jan 19, 2025
2 parents f17b300 + 5ef2695 commit be57207
Show file tree
Hide file tree
Showing 142 changed files with 7,156 additions and 7,516 deletions.
8 changes: 4 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
./client/node_modules
./server/dist
./server/programs
./server/tmp
./client/node_modules/
./server/dist/
./server/programs/
./server/tmp/
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3.5.2
uses: actions/checkout@v4.2.2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -53,7 +53,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -67,4 +67,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
4 changes: 2 additions & 2 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3.5.2
uses: actions/checkout@v4.2.2

- name: Set ENV
run: |
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ jobs:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3.5.2
uses: actions/checkout@v4.2.2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PUBLISH_PACKAGE_PAT }}

- name: Build Docker image
run: |
docker build --build-arg version="${{ github.event.inputs.version }}" --no-cache -t webserver .
docker build --build-arg VITE_VERSION="${{ github.event.inputs.version }}" --no-cache -t webserver .
docker tag webserver "ghcr.io/pacstall/webserver:${{ github.event.inputs.version }}"
docker tag webserver ghcr.io/pacstall/webserver:latest
- name: Push Image
run: |
docker push "ghcr.io/pacstall/webserver:${{ github.event.inputs.version }}"
docker push ghcr.io/pacstall/webserver:latest
docker push ghcr.io/pacstall/webserver:latest
1 change: 1 addition & 0 deletions .rgignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
client/public/swagger/*
15 changes: 7 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM node:20-alpine AS client
FROM node:22-alpine AS client

ARG VERSION
ENV VERSION="${VERSION}"
ARG VITE_VERSION
ENV VITE_VERSION="${VITE_VERSION}"
ENV NODE_ENV="production"

WORKDIR /root/
Expand All @@ -10,10 +10,10 @@ COPY ./client ./client
COPY ./Makefile ./Makefile

RUN apk add --no-cache make
RUN make VERSION=${VERSION} client/dist
RUN make VITE_VERSION=${VITE_VERSION} client/dist


FROM golang:1.20-alpine AS server
FROM golang:1.23-alpine AS server
WORKDIR /root/

COPY ./server ./server
Expand All @@ -22,7 +22,7 @@ COPY ./Makefile ./Makefile
RUN apk add --no-cache make gcc musl-dev
RUN make server/dist

FROM ubuntu:22.04
FROM ubuntu:24.04
WORKDIR /root/

RUN apt update
Expand All @@ -32,7 +32,7 @@ COPY --from=client /root/client/dist/ /root/client/dist/
COPY --from=server /root/server/dist/ /root/server/dist/
COPY ./Makefile ./Makefile

RUN apt update && apt install make git -y
RUN apt update && apt install make git jq -y

RUN make dist \
&& rm -rf server client
Expand All @@ -41,6 +41,5 @@ WORKDIR /root/dist/

RUN ls -al /root/dist


CMD echo "Starting webserver in a few seconds..." && sleep 3 && "./webserver"
EXPOSE 3300
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ server/dist: $(shell find server -not \( -path server/tmp -prune \) -not \( -pat

client/dist: $(shell find client -not \( -path client/dist -prune \) -not \( -path client/.parcel-cache -prune \) -type f)
which node
+$(MAKE) -s -C client
+$(MAKE) -s -C client

dist:
mkdir -p dist
Expand All @@ -16,7 +16,7 @@ dist:
cp -r server/dist/* dist

docker:
docker build --rm --build-arg VERSION="${VERSION}" --no-cache -t webserver .
docker build --rm --build-arg VITE_VERSION="${VERSION}" --no-cache -t webserver .
docker tag webserver "ghcr.io/pacstall/webserver:${VERSION}"
docker tag webserver ghcr.io/pacstall/webserver:latest

Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# The Pacstall Website

## Stats

<p align="center"><img alt="Repobeats analytics image" src="https://repobeats.axiom.co/api/embed/eda50f5088638b97b7f64e29c0f2d65c7fb89568.svg" /></p>

## How to Run

First, clone this repo and go to its directory.

```sh
git clone https://github.com/pacstall/website
cd website
```

Then, choose an option below depending on if you're planning to make changes to the website or to just run it.

### Run it for Development

```sh
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --force-recreate --build
```

### Run it in Production

```sh
docker-compose pull && docker-compose down && docker-compose up -d
```
4 changes: 2 additions & 2 deletions client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ dist: $(shell find . -not \( -path dist -prune \) -not \( -path .parcel-cache -p
npm install
npm run lint
npm run clean
npm run build
VITE_VERSION=$$VITE_VERSION npm run build

run:
npm install
npm run lint:fix
npm start
npm start
5 changes: 3 additions & 2 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
Expand Down Expand Up @@ -28,8 +28,9 @@
/>
<meta property="twitter:image" content="/pacstall.svg" />
<meta name="apple-mobile-web-app-title" content="Pacstall" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="darkreader-lock" />
<link rel="shortcut icon" type="image/jpg" href="/favicon.ico" />
<link rel="image_src" href="/pacstall.svg" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
Expand Down
91 changes: 53 additions & 38 deletions client/index.production.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
Expand All @@ -16,52 +16,67 @@
<meta property="twitter:description" content="{{.Description}}" />
<meta property="twitter:image" content="/pacstall.svg" />
<meta name="apple-mobile-web-app-title" content="Pacstall" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="shortcut icon" type="image/jpg" href="/favicon.ico" />
<link rel="image_src" href="/pacstall.svg" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<meta name="next-head-count" content="20" />
<link rel="stylesheet" href="/styles/global.css" />
<meta name="darkreader-lock" />
<link
rel="search"
type="application/opensearchdescription+xml"
href="/opensearch.xml"
title="Pacstall"
/>
<script>
var _paq = (window._paq = window._paq || [])
const IS_TRACKING_ALLOWED = navigator.doNotTrack !== '1'

_paq.push(['trackPageView'])
_paq.push(['enableLinkTracking'])
;(function () {
var u = '//pacstall.dev/matomo/'
_paq.push(['setTrackerUrl', u + 'matomo.php'])
_paq.push(['setSiteId', '1'])
var d = document,
g = d.createElement('script'),
s = d.getElementsByTagName('script')[0]
g.async = true
g.src = u + 'matomo.js'
s.parentNode.insertBefore(g, s)
})()
;(function () {
var url = window.location.href
setInterval(function () {
if (url != window.location.href) {
url = window.location.href
if (IS_TRACKING_ALLOWED) {
enableMatomoTracking()
}

// Track page view after 0.75s to catch the title change
setTimeout(function () {
_paq.push([
'setCustomUrl',
window.location.href.split(
'https://pacstall.dev',
)[1],
])
_paq.push([
'setDocumentTitle',
window.document.title,
])
_paq.push(['trackPageView'])
}, 750)
}
}, 100)
})()
function enableMatomoTracking() {
var _paq = (window._paq = window._paq || [])

_paq.push(['trackPageView'])
_paq.push(['enableLinkTracking'])
;(function () {
var u = '//pacstall.dev/matomo/'
_paq.push(['setTrackerUrl', u + 'matomo.php'])
_paq.push(['setSiteId', '1'])
var d = document,
g = d.createElement('script'),
s = d.getElementsByTagName('script')[0]
g.async = true
g.src = u + 'matomo.js'
s.parentNode.insertBefore(g, s)
})()
;(function () {
var url = window.location.href
setInterval(function () {
if (url != window.location.href) {
url = window.location.href

// Track page view after 0.75s to catch the title change
setTimeout(function () {
_paq.push([
'setCustomUrl',
window.location.href.split(
'https://pacstall.dev',
)[1],
])
_paq.push([
'setDocumentTitle',
window.document.title,
])
_paq.push(['trackPageView'])
}, 750)
}
}, 100)
})()
}
</script>
</head>

Expand Down
Loading

0 comments on commit be57207

Please sign in to comment.