Skip to content

Commit

Permalink
Merge pull request #205 from Suwayomi/main
Browse files Browse the repository at this point in the history
History
  • Loading branch information
Robonau authored Jun 25, 2024
2 parents f10934e + 6e95513 commit 52876c0
Show file tree
Hide file tree
Showing 20 changed files with 587 additions and 257 deletions.
112 changes: 47 additions & 65 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,38 @@

name: Build

env:
THEMES: "['', 'wintry', 'skeleton', 'crimson', 'gold-nouveau', 'hamlindigo', 'modern', 'rocket', 'sahara', 'seafoam', 'vintage']"

on:
workflow_dispatch:
push:
branches: ['Release']
paths-ignore:
- '**/README.md'

defaults:
run:
shell: bash

jobs:
RepoName:
runs-on: ubuntu-latest
outputs:
value: ${{ steps.RepoName.outputs.lowercase }}
steps:
- name: Get Repo Name
id: RepoName
uses: ASzc/change-string-case-action@v6
with:
string: ${{ github.repository_owner }}/${{ github.event.repository.name }}
- name: Set Repo Name
run: echo "REPO_NAME=${{ steps.RepoName.outputs.lowercase }}" >> $GITHUB_OUTPUT
ComputeThemes:
runs-on: ubuntu-latest
outputs:
value: ${{ env.THEMES }}
steps:
- name: Compute Themes
run: |
echo "value=$THEMES" >> $GITHUB_OUTPUT
GenTag:
outputs:
value: ${{steps.GenTagName.outputs.value}}
Expand All @@ -41,19 +61,22 @@ jobs:
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Use bun 1.1.0
- name: Use bun latest
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install bun dependencies
run: bun i
- run: bun run build
- run: echo "${{ needs.GenTag.outputs.value }}" > ./build/revision
- run: sed -i "s@BUILD_VERSION_PLACEHOLDER@${{ needs.GenTag.outputs.value }}@" ./build/index.html
- name: Set Build version
run: |
cd ./build
find . -name '*.html' -exec sed -i -e "s@BUILD_VERSION_PLACEHOLDER@${{ needs.GenTag.outputs.value }}@" {} \;
- run: bun run build-md5
- uses: actions/upload-artifact@v4
with:
name: build-files-${{ needs.GenTag.outputs.value }}
name: build-files
path: |
./build/
./buildZip/md5sum
Expand All @@ -67,7 +90,7 @@ jobs:
- name: get Build files
uses: actions/download-artifact@v4
with:
name: build-files-${{ needs.GenTag.outputs.value }}
name: build-files
path: ./
- name: Generate zip
working-directory: ./build
Expand All @@ -83,73 +106,27 @@ jobs:
body: ''
draft: false
prerelease: false
dockerBuilds:
strategy:
matrix:
theme: ${{ fromJSON(github.env.THEMES) }}
docker:
needs:
- build
- GenTag
- ComputeThemes
- RepoName
runs-on: ubuntu-latest
steps:
- name: get Build files
uses: actions/download-artifact@v4
with:
name: build-files-${{ needs.GenTag.outputs.value }}
path: ./
- name: Replace theme in the HTML files to generate differant theme builds
if: ${{ matrix.theme != '' }}
uses: richardrigutins/replace-in-files@v2
with:
files: '**/*.html'
search-text: data-theme='skeleton'
replacement-text: data-theme='${{ matrix.theme }}'
encoding: utf8
- name: Check out Dockerfile
uses: actions/checkout@v4
with:
sparse-checkout: |
Dockerfile
sparse-checkout: Dockerfile
- name: get Build files
uses: actions/download-artifact@v4
with:
name: build-files-${{ needs.GenTag.outputs.value }}-${{ matrix.theme }}
name: build-files
path: ./
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64, linux/386, linux/ppc64le, linux/s390x
context: .
build-args: version=${{ needs.GenTag.outputs.value }}
push: false
outputs: type=docker,dest=/tmp/${{ matrix.theme }}.tar
tags: |
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest${{ matrix.theme }},
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ needs.GenTag.outputs.value }}${{ matrix.theme }},
${{ github.repository_owner }}/${{ github.event.repository.name }}:latest${{ matrix.theme }},
${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ needs.GenTag.outputs.value }}${{ matrix.theme }},
- uses: actions/upload-artifact@v4
with:
name: build-files-${{ needs.GenTag.outputs.value }}-${{ matrix.theme }}
path: |
/tmp/${{ matrix.theme }}.tar
docker:
needs:
- build
- GenTag
- dockerBuilds
runs-on: ubuntu-latest
steps:
- name: get Build files
uses: actions/download-artifact@v4
with:
name: build-files-${{ needs.GenTag.outputs.value }}-*
path: ./
merge-multiple: true
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
Expand All @@ -161,10 +138,15 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Load ad push image
run: |
for f in *.tar; do
cat $f | docker load
done
docker push -a ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
docker push -a ${{ github.repository_owner }}/${{ github.event.repository.name }}
- name: Build Docker image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64, linux/386, linux/ppc64le, linux/s390x
context: .
build-args: version=${{ needs.GenTag.outputs.value }}
push: true
tags: |
ghcr.io/${{ needs.RepoName.outputs.value }}:latest,
ghcr.io/${{ needs.RepoName.outputs.value }}:${{ needs.GenTag.outputs.value }},
${{ needs.RepoName.outputs.value }}:latest,
${{ needs.RepoName.outputs.value }}:${{ needs.GenTag.outputs.value }},
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use bun 1.0.10
- name: Use bun latest
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
Expand All @@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use bun 1.0.10
- name: Use bun latest
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use bun 1.0.10
- name: Use bun latest
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,6 @@
"codeium.enableInComments": false,
"codeium.enableSearch": true,
"tailwind-fold.unfoldIfLineSelected": true,
"tailwind-fold.foldLengthThreshold": 5
"tailwind-fold.foldLengthThreshold": 80,
"tailwind-fold.unfoldedTextOpacity": 1
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/nginxinc/nginx-unprivileged:1.25.3-alpine-slim as production-stage
FROM ghcr.io/nginxinc/nginx-unprivileged:1.25.3-alpine-slim
USER root
COPY ./build /usr/share/nginx/html
COPY ./default.conf /etc/nginx/conf.d/default.conf
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ services:
- suwayomi=http://suwayomi:4567/
# will proxy the suwayomi server to the UI
# if you plan on proxying it externally then this is unnecessary
- theme=skeleton
# defaults to skeleton
# is for the SSR to stop off first loads
# any of the themes avalabe in VUI
# skeleton, wintry, crimson, gold-nouveau, hamlindigo, modern, rocket, sahara, seafoam, vintage
restart: unless-stopped
```
Expand Down
9 changes: 0 additions & 9 deletions default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,4 @@ server {
proxy_set_header Connection $http_connection;
proxy_set_header Upgrade $http_upgrade;
}

# location /v1 {
# resolver resolverPLACEHOLDER 8.8.8.8 valid=30s ipv6=off;
# set $upstreame https://api.mangaupdates.com;
# proxy_pass $upstreame;
# proxy_http_version 1.1;
# proxy_set_header Connection $http_connection;
# proxy_set_header Upgrade $http_upgrade;
# }
}
9 changes: 9 additions & 0 deletions docker-compose-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ services:
- suwayomi=http://suwayomi:4567
# will proxy the suwayomi server to the UI
# if you plan on proxying it externally then this is unnecessary
- theme=skeleton
# is for the SSR to stop off first loads
# defaults to skeleton
# any of the themes avalabe in VUI
# skeleton, wintry, crimson, gold-nouveau, hamlindigo, modern, rocket, sahara, seafoam, vintage
- light=false
# is for the SSR to stop off first loads
# defaults to false
# true will turn on the light mode
restart: unless-stopped

vui3-dev:
Expand Down
10 changes: 9 additions & 1 deletion set-env-variable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,12 @@ $1=="nameserver" && $2!~/^((25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])\.?){4}$/{
print "["$2"]"
}' /etc/resolv.conf)
sed -i "s@resolverPLACEHOLDER@$TMP2@" /etc/nginx/conf.d/default.conf
sed -i "s@PLACEHOLDER@$TMP@" /etc/nginx/conf.d/default.conf
sed -i "s@PLACEHOLDER@$TMP@" /etc/nginx/conf.d/default.conf

cd /usr/share/nginx/html
${theme:="skeleton"}
find . -name '*.html' -exec sed -i -e "s/data-theme=\"skeleton\"/data-theme=\"$theme\"/g" {} \;

if [[ "${light}" = "true" || "${light}" = "True" || "${light}" = "TRUE" ]]; then
find . -name '*.html' -exec sed -i -e 's/<html lang="en" class="dark">/<html lang="en" class>/g' {} \;
fi
6 changes: 3 additions & 3 deletions src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<html lang="en" class="dark">
<head>
<style>
/* stop the flash bang */
html.dark > body[data-theme='skeleton'] {
background-color: rgb(36, 44, 70);
/* remove the flashbang */
html.dark {
background-color: #1f2937;
}
</style>
<meta charset="utf-8" />
Expand Down
23 changes: 23 additions & 0 deletions src/lib/AppNavData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ export const AppNavData = [
return page.includes('/browse');
}
},
{
href: '/history',
title: 'History',
icon: 'mdi:history',
match: (page: string) => {
return page.includes('/history');
}
},
{
href: '/downloads',
title: 'Downloads',
Expand All @@ -46,3 +54,18 @@ export const AppNavData = [
}
}
];

export const SmallAppNavData = [
AppNavData[0],
AppNavData[1],
AppNavData[2],
AppNavData[3],
{
href: '/more',
title: 'More',
icon: 'mdi:dots-horizontal',
match: (page: string) => {
return page.includes('/more');
}
}
];
37 changes: 21 additions & 16 deletions src/lib/components/MobileAppNavigation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import { page } from '$app/stores';
import { TabGroup, TabAnchor } from '@skeletonlabs/skeleton';
import IconWrapper from './IconWrapper.svelte';
import { AppNavData } from '../AppNavData';
import { AppNavData, SmallAppNavData } from '../AppNavData';
import { screens } from '$lib/screens';
import MediaQuery from './MediaQuery.svelte';
</script>

<TabGroup
Expand All @@ -23,19 +25,22 @@
class="bg-surface-100-800-token w-full"
regionList=" h-16"
>
{#each AppNavData as Loc}
<TabAnchor
href={Loc.href}
selected={Loc.match($page.url.pathname)}
class="h-full [&>.tab-interface]:h-full [&>div>.tab-label]:h-full"
>
<div class="flex h-full w-full flex-col items-center">
<IconWrapper
name={Loc.icon}
class="aspect-square max-h-full w-full grow"
/>
<span class="text-sm">{Loc.title}</span>
</div>
</TabAnchor>
{/each}
<MediaQuery query="(max-width: {screens.sm})" let:matches>
{@const Nav = matches ? SmallAppNavData : AppNavData}
{#each Nav as Loc}
<TabAnchor
href={Loc.href}
selected={Loc.match($page.url.pathname)}
class="h-full [&>.tab-interface]:h-full [&>div>.tab-label]:h-full"
>
<div class="flex h-full w-full flex-col items-center">
<IconWrapper
name={Loc.icon}
class="aspect-square max-h-full w-full grow"
/>
<span class="text-sm">{Loc.title}</span>
</div>
</TabAnchor>
{/each}
</MediaQuery>
</TabGroup>
Loading

0 comments on commit 52876c0

Please sign in to comment.