diff --git a/.gitea/workflows/minify.yaml b/.gitea/workflows/minify.yaml new file mode 100644 index 0000000..b03b195 --- /dev/null +++ b/.gitea/workflows/minify.yaml @@ -0,0 +1,46 @@ +name: Minify HTML and CSS + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + minify: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Install minification tools + run: | + npm install -g html-minifier-terser csso-cli + + - name: Minify HTML files + run: | + find src/ -name '*.html' ! -name '*min*' -exec sh -c 'html-minifier-terser --collapse-whitespace --remove-comments --minify-js true --minify-css true -o "${0%.html}.min.html" "$0"' {} \; + + - name: Minify CSS files + run: | + find src/css/ -name '*.css' ! -name '*min*' -exec sh -c 'csso "$0" --output "${0%.css}.min.css"' {} \; + + - name: Commit and push changes + env: + USERNAME_GITEA: ${{ secrets.USERNAME_GITEA }} + TOKEN_GITEA: ${{ secrets.TOKEN_GITEA }} + run: | + git config --global user.name "LibreCloud Actions Bot" + git config --global user.email "git@pontusmail.org" + git remote set-url origin https://${USERNAME_GITEA}:${TOKEN_GITEA}@git.pontusmail.org/aidan/pontus.git + git add . + git commit -m "[bot] Minifying HTML and CSS automatically" + git push origin main diff --git a/default.conf b/default.conf new file mode 100644 index 0000000..a21f827 --- /dev/null +++ b/default.conf @@ -0,0 +1,27 @@ +server { + listen 80; + listen [::]:80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.min.html; + autoindex on; + } + + # TODO: This could be improved later + location = /links { + root /usr/share/nginx/html; + index links.min.html; + try_files /links.min.html =404; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..5640748 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +services: + pontus-web: + build: . + image: pontus-web:latest + restart: always + ports: + - "2280:80" + volumes: + - ./default.conf:/etc/nginx/conf.d/default.conf + - ./src:/usr/share/nginx/html \ No newline at end of file diff --git a/self b/self deleted file mode 100755 index 6dfbd40..0000000 --- a/self +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -SC_VERSION=1.0.0 -SC_CODENAME="portal" -COLOR_RESET="\033[0m" -COLOR_GREEN="\033[1;32m" -COLOR_RED="\033[1;31m" -COLOR_YELLOW="\033[1;33m" -COLOR_BLUE="\033[1;34m" -COLOR_CYAN="\033[1;36m" - -function start() { - if [ ! -d "src" ]; then - echo -e "${COLOR_RED}src directory not found, cannot continue${COLOR_RESET}" - exit 1 - fi - - mkdir -p public - - cp -r src/* public/ - echo -e "${COLOR_GREEN}Created public dir and copied files successfully${COLOR_RESET}" -} - -function stop() { - if [ -d "public" ]; then - rm -rf public - echo -e "${COLOR_GREEN}Deleted public directory${COLOR_RESET}" - else - echo -e "${COLOR_RED}No public directory to delete${COLOR_RESET}" - fi -} - -function help() { - echo -e "${COLOR_GREEN}self version:${COLOR_RESET} ${COLOR_BLUE}${SC_VERSION} ${SC_CODENAME}${COLOR_RESET}" - echo -e "${COLOR_BLUE}Usage:${COLOR_RESET} ./self [command]\n" - echo -e "${COLOR_YELLOW}Commands:${COLOR_RESET}" - echo -e " ${COLOR_CYAN}help${COLOR_RESET} Shows this help message." - echo -e " ${COLOR_CYAN}start${COLOR_RESET} Copies files to public directory." - echo -e " ${COLOR_CYAN}stop${COLOR_RESET} Removes public directory." -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - help) - help - ;; - *) - echo -e "${COLOR_RED}Invalid command: $1\n${COLOR_RESET}" - help - exit 1 - ;; -esac \ No newline at end of file diff --git a/src/css/main.min.css b/src/css/main.min.css new file mode 100644 index 0000000..f4bf161 --- /dev/null +++ b/src/css/main.min.css @@ -0,0 +1 @@ +@font-face{font-family:"RainyHearts";src:url(/fonts/rainyhearts.ttf)format("truetype");font-weight:400;font-style:normal}@font-face{font-family:"Daydream";src:url(/fonts/Daydream.ttf)format("truetype");font-weight:400;font-style:normal}body{font-family:"RainyHearts"}h1{font-size:x-large}.title,h1{font-family:"Daydream"}.container{display:flex;height:97.5vh;overflow:hidden}.sidebar{width:17%;box-sizing:border-box;overflow-y:auto;-ms-overflow-style:none;scrollbar-width:none}.sidebar::-webkit-scrollbar{display:none}.sidebar a{display:block;margin:7px 0}.main-content{width:80%;overflow-y:auto;padding:0 20px 20px;box-sizing:border-box}.bt-section,.sb-itm{padding:10px 20px 20px;background-color:#f0f0f0;margin-bottom:5%}.bt-section{display:flex;flex-wrap:wrap;gap:10px}.bt-section a,.bt-section img{display:inline-block;margin:0}.contained-blinkie{width:100%}.contained-button img{width:44%}.fac img{padding-top:20px}*{cursor:url(https://cur.cursors-4u.net/cursors/cur-11/cur1055.ani),url(https://cur.cursors-4u.net/cursors/cur-11/cur1055.png),auto!important} \ No newline at end of file diff --git a/src/index.html b/src/index.html index a77d998..ddb1b7c 100644 --- a/src/index.html +++ b/src/index.html @@ -4,7 +4,7 @@ pontus - + @@ -13,7 +13,7 @@

menu

home - links + links

archives

diff --git a/src/links.html b/src/links.html index 2fd6bb7..c50c9ef 100644 --- a/src/links.html +++ b/src/links.html @@ -4,7 +4,7 @@ pontus - +