Compare commits
149 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4cc96de806 | |||
| d27ef12039 | |||
| f3c2ee4c40 | |||
| 555f73b478 | |||
| 544bf2ea21 | |||
| 54bbb5e384 | |||
| b10062c73d | |||
| a027d6df1b | |||
| 926a53a4b0 | |||
| 406cb46170 | |||
| acc58dc892 | |||
| 55894c22a4 | |||
| 476b10b862 | |||
| 3cbbe446ab | |||
| 4cf7512ee0 | |||
| ee8ec460a1 | |||
| deecab3cca | |||
| d2f5c1a195 | |||
| dba77e26a3 | |||
| fa48bafbc6 | |||
| 73c48694c7 | |||
| 0ff89d039b | |||
| 7a7081ee13 | |||
| 874aaf4e93 | |||
| ebf076d9f6 | |||
| 073a041d4c | |||
| 96a9b4dabd | |||
| 8e4cdf2386 | |||
| ab4d925a5a | |||
| d9c6f52e21 | |||
| 0a748cd53b | |||
| 07314ef018 | |||
| 5eaebf678f | |||
| 80fbfa60de | |||
| fbbcc9e9b6 | |||
| f47dc6b9de | |||
| 5f8e74f017 | |||
| 8c1ca0ac7e | |||
| 9018de3c4c | |||
| e7cb88c757 | |||
| d6127d6811 | |||
| 67e09e2e1d | |||
| 8fbc24c751 | |||
| c0948209be | |||
| 7237161d52 | |||
| 94c2e21e2b | |||
| 65067e6e01 | |||
| 39490ce7ba | |||
| 2f3f47c745 | |||
| 2195c3df76 | |||
| 119b9db6b4 | |||
| fcbc598732 | |||
| e850049e8e | |||
| 907adea73f | |||
| 2ac5c1362c | |||
| 8b20e2b48f | |||
| c2a9820fc1 | |||
| a9e5bc0c95 | |||
| 0fa2834d25 | |||
| 23f0876c00 | |||
| 6d88d90659 | |||
| a3c366c360 | |||
| 3bef07eeab | |||
| d029e65b8e | |||
| f305ac6905 | |||
| 4d4a46d2a5 | |||
| 8218f2f830 | |||
| b1bf901eac | |||
| 06eff55210 | |||
| 71730fddad | |||
| f2d1c6e3cb | |||
| 7ae837ca3c | |||
| b10908df5e | |||
| 4dd4d38d5b | |||
| 447c286b56 | |||
| c71898ece9 | |||
| 9473e88ea9 | |||
| d7663ed56e | |||
| da7569e2f5 | |||
| d989940a4d | |||
| bd6a86b135 | |||
| b38eb11503 | |||
| 7aef32c13d | |||
| fab64b147c | |||
| cc5a63205c | |||
| 814166a884 | |||
| 55240d9e9b | |||
| 9dc598150f | |||
| 21c087e273 | |||
| bdf3a7014f | |||
| dfea6e9b1b | |||
| 50eef1190e | |||
| ed180121ff | |||
| bdb0ad89d4 | |||
| 7195a30d55 | |||
| 5b0426a94c | |||
| a6d012abd9 | |||
| 86f0b3f29f | |||
| 85e3aa34ac | |||
| 5bbc1dedef | |||
| 39b468ef06 | |||
| fe17176b31 | |||
| 84f701c4ab | |||
| 047f8c176f | |||
| d82e79b680 | |||
| 320d1ae9d8 | |||
| a8892143a2 | |||
| 50f4532406 | |||
| 844454053d | |||
| db5c5ed534 | |||
| a26b8ecca0 | |||
| 5a32ccfa7a | |||
| f51818b157 | |||
| 31a624db51 | |||
| f045b18762 | |||
| f5006cac7d | |||
| 152b193ad5 | |||
| a27af0b642 | |||
| 44ffed3f7c | |||
| fa035ad9be | |||
| 186ace4343 | |||
| 8fb1a0bb1f | |||
| 05513bf8b9 | |||
| 858784857e | |||
| 291a23949a | |||
| 454de23844 | |||
| 1176092fc6 | |||
| 0fc2c57395 | |||
| 0b292f8d74 | |||
| 4bbe51331f | |||
| c289786dfa | |||
| 9a9752a6a1 | |||
| c43b688f8e | |||
| a6272d5221 | |||
| b440a58d95 | |||
| ec1589aa2d | |||
| 8d48e56fa0 | |||
| df7938037e | |||
| c908ee2d49 | |||
| b714abddae | |||
| 63ca189907 | |||
| 6130fb9ba2 | |||
| f0edc676fc | |||
| b68fdb0772 | |||
| 76c7bdd604 | |||
| 205101568e | |||
| efff68c49b | |||
| f74f60bb1d | |||
| 63ea28a620 |
@@ -10,7 +10,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Clone repo
|
- name: Clone repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Validate Gradle Wrapper
|
- name: Validate Gradle Wrapper
|
||||||
uses: gradle/wrapper-validation-action@v1
|
uses: gradle/wrapper-validation-action@v1
|
||||||
@@ -23,7 +23,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Cancel previous runs
|
- name: Cancel previous runs
|
||||||
uses: styfle/cancel-workflow-action@0.9.0
|
uses: styfle/cancel-workflow-action@0.10.0
|
||||||
with:
|
with:
|
||||||
access_token: ${{ github.token }}
|
access_token: ${{ github.token }}
|
||||||
|
|
||||||
@@ -45,13 +45,9 @@ jobs:
|
|||||||
mkdir -p ~/.gradle
|
mkdir -p ~/.gradle
|
||||||
cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties
|
cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties
|
||||||
|
|
||||||
|
|
||||||
- name: Build Jar
|
- name: Build Jar
|
||||||
uses: eskatos/gradle-command-action@v1
|
uses: gradle/gradle-build-action@v2
|
||||||
with:
|
with:
|
||||||
build-root-directory: master
|
build-root-directory: master
|
||||||
wrapper-directory: master
|
|
||||||
arguments: :server:shadowJar --stacktrace
|
arguments: :server:shadowJar --stacktrace
|
||||||
wrapper-cache-enabled: true
|
|
||||||
dependencies-cache-enabled: true
|
|
||||||
configuration-cache-enabled: true
|
|
||||||
|
|||||||
@@ -9,28 +9,26 @@ jobs:
|
|||||||
check_wrapper:
|
check_wrapper:
|
||||||
name: Validate Gradle Wrapper
|
name: Validate Gradle Wrapper
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Clone repo
|
- name: Clone repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Validate Gradle Wrapper
|
- name: Validate Gradle Wrapper
|
||||||
uses: gradle/wrapper-validation-action@v1
|
uses: gradle/wrapper-validation-action@v1
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build artifacts and deploy preview
|
name: Build Jar
|
||||||
needs: check_wrapper
|
needs: check_wrapper
|
||||||
if: "!startsWith(github.event.head_commit.message, '[SKIP CI]')"
|
if: "!startsWith(github.event.head_commit.message, '[SKIP CI]')"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Cancel previous runs
|
- name: Cancel previous runs
|
||||||
uses: styfle/cancel-workflow-action@0.9.0
|
uses: styfle/cancel-workflow-action@0.10.0
|
||||||
with:
|
with:
|
||||||
access_token: ${{ github.token }}
|
access_token: ${{ github.token }}
|
||||||
|
|
||||||
- name: Checkout master branch
|
- name: Checkout master branch
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: master
|
ref: master
|
||||||
path: master
|
path: master
|
||||||
@@ -48,42 +46,136 @@ jobs:
|
|||||||
cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties
|
cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties
|
||||||
|
|
||||||
- name: Build Jar
|
- name: Build Jar
|
||||||
uses: eskatos/gradle-command-action@v1
|
uses: gradle/gradle-build-action@v2
|
||||||
env:
|
env:
|
||||||
ProductBuildType: "Preview"
|
ProductBuildType: "Preview"
|
||||||
with:
|
with:
|
||||||
build-root-directory: master
|
build-root-directory: master
|
||||||
wrapper-directory: master
|
|
||||||
arguments: :server:shadowJar --stacktrace
|
arguments: :server:shadowJar --stacktrace
|
||||||
wrapper-cache-enabled: true
|
|
||||||
dependencies-cache-enabled: true
|
- name: Upload Jar
|
||||||
configuration-cache-enabled: true
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: jar
|
||||||
|
path: master/server/build/*.jar
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Upload icons
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: icon
|
||||||
|
path: master/server/src/main/resources/icon
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Tar scripts dir to maintain file permissions
|
||||||
|
run: tar -cvzf scripts.tar.gz -C master/ scripts/
|
||||||
|
- name: Upload scripts.tar.gz
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: scripts
|
||||||
|
path: scripts.tar.gz
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
bundle:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- debian-all
|
||||||
|
- linux-assets
|
||||||
|
- linux-x64
|
||||||
|
- macOS-x64
|
||||||
|
- macOS-arm64
|
||||||
|
- windows-x64
|
||||||
|
- windows-x86
|
||||||
|
|
||||||
|
name: Make ${{ matrix.os }} release
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Download Jar
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: jar
|
||||||
|
path: server/build
|
||||||
|
|
||||||
|
- name: Download icons
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: icon
|
||||||
|
path: server/src/main/resources/icon
|
||||||
|
|
||||||
|
- name: Download scripts.tar.gz
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: scripts
|
||||||
|
|
||||||
|
- name: Make ${{ matrix.os }} release
|
||||||
|
run: |
|
||||||
|
mkdir upload
|
||||||
|
tar -xvpf scripts.tar.gz
|
||||||
|
scripts/bundler.sh -o upload/ ${{ matrix.os }}
|
||||||
|
|
||||||
|
- name: Upload ${{ matrix.os }} release
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.os }}
|
||||||
|
path: upload/*
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
release:
|
||||||
|
needs: bundle
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: jar
|
||||||
|
path: release
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: debian-all
|
||||||
|
path: release
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: linux-assets
|
||||||
|
path: release
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: linux-x64
|
||||||
|
path: release
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: macOS-x64
|
||||||
|
path: release
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: macOS-arm64
|
||||||
|
path: release
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: windows-x64
|
||||||
|
path: release
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: windows-x86
|
||||||
|
path: release
|
||||||
|
|
||||||
|
- name: Checkout Preview branch
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
repository: "Suwayomi/Tachidesk-Server-preview"
|
||||||
|
ref: main
|
||||||
|
path: preview
|
||||||
|
token: ${{ secrets.DEPLOY_PREVIEW_TOKEN }}
|
||||||
|
|
||||||
- name: Generate Tag Name
|
- name: Generate Tag Name
|
||||||
id: GenTagName
|
id: GenTagName
|
||||||
run: |
|
run: |
|
||||||
cd master/server/build
|
cd release
|
||||||
genTag=$(ls *.jar | sed -e's/Tachidesk-Server-\|.jar//g')
|
genTag=$(ls *.jar | sed -e's/Tachidesk-Server-\|.jar//g')
|
||||||
echo "$genTag"
|
echo "$genTag"
|
||||||
echo "::set-output name=value::$genTag"
|
echo "::set-output name=value::$genTag"
|
||||||
|
|
||||||
- name: make bundle packages
|
|
||||||
run: |
|
|
||||||
cd master/scripts
|
|
||||||
./windows-bundler.sh win32
|
|
||||||
./windows-bundler.sh win64
|
|
||||||
./unix-bundler.sh linux-x64
|
|
||||||
./unix-bundler.sh macOS-x64
|
|
||||||
./unix-bundler.sh macOS-arm64
|
|
||||||
|
|
||||||
- name: Checkout preview branch
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
repository: 'Suwayomi/Tachidesk-Server-preview'
|
|
||||||
ref: main
|
|
||||||
path: preview
|
|
||||||
token: ${{ secrets.DEPLOY_PREVIEW_TOKEN }}
|
|
||||||
|
|
||||||
- name: Create Tag
|
- name: Create Tag
|
||||||
run: |
|
run: |
|
||||||
TAG="${{ steps.GenTagName.outputs.value }}"
|
TAG="${{ steps.GenTagName.outputs.value }}"
|
||||||
@@ -91,7 +183,8 @@ jobs:
|
|||||||
cd preview
|
cd preview
|
||||||
echo "{ \"latest\": \"$TAG\" }" > index.json
|
echo "{ \"latest\": \"$TAG\" }" > index.json
|
||||||
git add index.json
|
git add index.json
|
||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
git config --global user.email \
|
||||||
|
"github-actions[bot]@users.noreply.github.com"
|
||||||
git config --global user.name "github-actions[bot]"
|
git config --global user.name "github-actions[bot]"
|
||||||
git commit -m "Updated to $TAG"
|
git commit -m "Updated to $TAG"
|
||||||
git push origin main
|
git push origin main
|
||||||
@@ -100,10 +193,10 @@ jobs:
|
|||||||
git push origin $TAG
|
git push origin $TAG
|
||||||
|
|
||||||
- name: Upload Preview Release
|
- name: Upload Preview Release
|
||||||
uses: ncipollo/release-action@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.DEPLOY_PREVIEW_TOKEN }}
|
token: ${{ secrets.DEPLOY_PREVIEW_TOKEN }}
|
||||||
artifacts: "master/server/build/*.jar,master/server/build/*.zip,master/server/build/*.tar.gz"
|
repository: "Suwayomi/Tachidesk-Server-preview"
|
||||||
owner: "Suwayomi"
|
tag_name: ${{ steps.GenTagName.outputs.value }}
|
||||||
repo: "Tachidesk-Server-preview"
|
files: release/*
|
||||||
tag: ${{ steps.GenTagName.outputs.value }}
|
|
||||||
|
|||||||
@@ -1,24 +1,35 @@
|
|||||||
name: Issue closer
|
name: Issue moderator
|
||||||
|
|
||||||
on:
|
on:
|
||||||
issues:
|
issues:
|
||||||
types: [opened, edited, reopened]
|
types: [opened, edited, reopened]
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
autoclose:
|
autoclose:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Autoclose issues
|
- name: Moderate issues
|
||||||
uses: arkon/issue-closer-action@v3.0
|
uses: tachiyomiorg/issue-moderator-action@v1
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ github.token }}
|
repo-token: ${{ github.token }}
|
||||||
rules: |
|
duplicate-check-enabled: true
|
||||||
|
duplicate-check-label: Source request
|
||||||
|
existing-check-enabled: true
|
||||||
|
existing-check-label: Source request
|
||||||
|
auto-close-rules: |
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"type": "title",
|
"type": "title",
|
||||||
"regex": ".*<short description>*",
|
"regex": ".*<short description>.*",
|
||||||
"message": "You did not fill out the description in the title"
|
"message": "You did not fill out the description in the title"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "title",
|
||||||
|
"regex": ".*(<|>)+.*",
|
||||||
|
"message": "You did not remove Angle brackets(< and >) from the title"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "body",
|
"type": "body",
|
||||||
"regex": ".*DELETE THIS SECTION IF YOU HAVE READ AND ACKNOWLEDGED IT.*",
|
"regex": ".*DELETE THIS SECTION IF YOU HAVE READ AND ACKNOWLEDGED IT.*",
|
||||||
@@ -26,7 +37,7 @@ jobs:
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "body",
|
"type": "body",
|
||||||
"regex": "(Tachidesk version|Server Operating System|Server Desktop Environment|Server JVM version|Client Operating System|Client Web Browser):.*(\\(Example:|<usually).*",
|
"regex": ".*(Tachidesk version|Server Operating System|Server Desktop Environment|Server JVM version|Client Operating System|Client Web Browser):.*(\\(Example:|<usually).*",
|
||||||
"message": "The requested information was not filled out"
|
"message": "The requested information was not filled out"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
+124
-29
@@ -1,35 +1,34 @@
|
|||||||
name: CI Publish
|
name: CI Publish
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- "v*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check_wrapper:
|
check_wrapper:
|
||||||
name: Validate Gradle Wrapper
|
name: Validate Gradle Wrapper
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Clone repo
|
- name: Clone repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Validate Gradle Wrapper
|
- name: Validate Gradle Wrapper
|
||||||
uses: gradle/wrapper-validation-action@v1
|
uses: gradle/wrapper-validation-action@v1
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build artifacts and release
|
name: Build Jar
|
||||||
needs: check_wrapper
|
needs: check_wrapper
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Cancel previous runs
|
- name: Cancel previous runs
|
||||||
uses: styfle/cancel-workflow-action@0.9.0
|
uses: styfle/cancel-workflow-action@0.10.0
|
||||||
with:
|
with:
|
||||||
access_token: ${{ github.token }}
|
access_token: ${{ github.token }}
|
||||||
|
|
||||||
- name: Checkout ${{ github.ref }}
|
- name: Checkout ${{ github.ref }}
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.ref }}
|
ref: ${{ github.ref }}
|
||||||
path: master
|
path: master
|
||||||
@@ -44,35 +43,131 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd master
|
cd master
|
||||||
mkdir -p ~/.gradle
|
mkdir -p ~/.gradle
|
||||||
cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties
|
cp .github/runner-files/ci-gradle.properties \
|
||||||
|
~/.gradle/gradle.properties
|
||||||
|
|
||||||
- name: Build and copy webUI, Build Jar
|
- name: Build and copy webUI, Build Jar
|
||||||
uses: eskatos/gradle-command-action@v1
|
uses: gradle/gradle-build-action@v2
|
||||||
env:
|
env:
|
||||||
ProductBuildType: "Stable"
|
ProductBuildType: "Stable"
|
||||||
with:
|
with:
|
||||||
build-root-directory: master
|
build-root-directory: master
|
||||||
wrapper-directory: master
|
|
||||||
arguments: :server:downloadWebUI :server:shadowJar --stacktrace
|
arguments: :server:downloadWebUI :server:shadowJar --stacktrace
|
||||||
wrapper-cache-enabled: true
|
|
||||||
dependencies-cache-enabled: true
|
|
||||||
configuration-cache-enabled: true
|
|
||||||
|
|
||||||
- name: make bundle packages
|
- name: Upload Jar
|
||||||
run: |
|
uses: actions/upload-artifact@v3
|
||||||
cd master/scripts
|
|
||||||
./windows-bundler.sh win32
|
|
||||||
./windows-bundler.sh win64
|
|
||||||
./unix-bundler.sh linux-x64
|
|
||||||
./unix-bundler.sh macOS-x64
|
|
||||||
./unix-bundler.sh macOS-arm64
|
|
||||||
|
|
||||||
- name: Upload Release
|
|
||||||
uses: xresloader/upload-to-github-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
with:
|
||||||
file: "master/server/build/*.jar;master/server/build/*.zip;master/server/build/*.tar.gz"
|
name: jar
|
||||||
tags: true
|
path: master/server/build/*.jar
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Upload icons
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: icon
|
||||||
|
path: master/server/src/main/resources/icon
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Tar scripts dir to maintain file permissions
|
||||||
|
run: tar -cvzf scripts.tar.gz -C master/ scripts/
|
||||||
|
- name: Upload scripts.tar.gz
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: scripts
|
||||||
|
path: scripts.tar.gz
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
bundle:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- debian-all
|
||||||
|
- linux-assets
|
||||||
|
- linux-x64
|
||||||
|
- macOS-x64
|
||||||
|
- macOS-arm64
|
||||||
|
- windows-x64
|
||||||
|
- windows-x86
|
||||||
|
|
||||||
|
name: Make ${{ matrix.os }} release
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Download Jar
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: jar
|
||||||
|
path: server/build
|
||||||
|
|
||||||
|
- name: Download icons
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: icon
|
||||||
|
path: server/src/main/resources/icon
|
||||||
|
|
||||||
|
- name: Download scripts.tar.gz
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: scripts
|
||||||
|
|
||||||
|
- name: Make ${{ matrix.os }} release
|
||||||
|
run: |
|
||||||
|
mkdir upload/
|
||||||
|
tar -xvpf scripts.tar.gz
|
||||||
|
scripts/bundler.sh -o upload/ ${{ matrix.os }}
|
||||||
|
|
||||||
|
- name: Upload ${{ matrix.os }} files
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.os }}
|
||||||
|
path: upload/*
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
release:
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
needs: bundle
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: jar
|
||||||
|
path: release
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: debian-all
|
||||||
|
path: release
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: linux-assets
|
||||||
|
path: release
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: linux-x64
|
||||||
|
path: release
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: macOS-x64
|
||||||
|
path: release
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: macOS-arm64
|
||||||
|
path: release
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: windows-x64
|
||||||
|
path: release
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: windows-x86
|
||||||
|
path: release
|
||||||
|
|
||||||
|
- name: Generate checksums
|
||||||
|
run: cd release && sha256sum * > Checksums.sha256
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.WINGET_PUBLISH_PAT }}
|
||||||
draft: true
|
draft: true
|
||||||
verbose: true
|
files: release/*
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
name: Publish to WinGet
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [released]
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: windows-latest # action can only be run on windows
|
||||||
|
steps:
|
||||||
|
- uses: vedantmgoyal2009/winget-releaser@v1
|
||||||
|
with:
|
||||||
|
identifier: Suwayomi.Tachidesk-Server
|
||||||
|
installers-regex: '.*x64.msi$'
|
||||||
|
token: ${{ secrets.WINGET_PUBLISH_PAT }}
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
.gradle
|
.gradle
|
||||||
.idea
|
.idea
|
||||||
gradle.properties
|
gradle.properties
|
||||||
|
.fleet
|
||||||
# But we need these
|
# But we need these
|
||||||
!.idea/runConfigurations
|
!.idea/runConfigurations
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
@Suppress("DSL_SCOPE_VIOLATION")
|
||||||
|
plugins {
|
||||||
|
id(libs.plugins.kotlin.jvm.get().pluginId)
|
||||||
|
id(libs.plugins.kotlin.serialization.get().pluginId)
|
||||||
|
id(libs.plugins.kotlinter.get().pluginId)
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// Shared
|
||||||
|
implementation(libs.bundles.shared)
|
||||||
|
testImplementation(libs.bundles.sharedTest)
|
||||||
|
}
|
||||||
@@ -1,28 +1,39 @@
|
|||||||
|
@Suppress("DSL_SCOPE_VIOLATION")
|
||||||
|
plugins {
|
||||||
|
id(libs.plugins.kotlin.jvm.get().pluginId)
|
||||||
|
id(libs.plugins.kotlin.serialization.get().pluginId)
|
||||||
|
id(libs.plugins.kotlinter.get().pluginId)
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
// Shared
|
||||||
|
implementation(libs.bundles.shared)
|
||||||
|
testImplementation(libs.bundles.sharedTest)
|
||||||
|
|
||||||
// Android stub library
|
// Android stub library
|
||||||
implementation("com.github.Suwayomi:android-jar:1.0.0")
|
implementation(libs.android.stubs)
|
||||||
|
|
||||||
// XML
|
// XML
|
||||||
compileOnly("xmlpull:xmlpull:1.1.3.4a")
|
compileOnly(libs.xmlpull)
|
||||||
|
|
||||||
// Config API
|
// Config API
|
||||||
implementation(project(":AndroidCompat:Config"))
|
implementation(projects.androidCompat.config)
|
||||||
|
|
||||||
// APK sig verifier
|
// APK sig verifier
|
||||||
compileOnly("com.android.tools.build:apksig:7.1.0-alpha12")
|
compileOnly(libs.apksig)
|
||||||
|
|
||||||
// AndroidX annotations
|
// AndroidX annotations
|
||||||
compileOnly("androidx.annotation:annotation:1.2.0")
|
compileOnly(libs.android.annotations)
|
||||||
|
|
||||||
// substitute for duktape-android
|
// substitute for duktape-android
|
||||||
implementation("org.mozilla:rhino-runtime:1.7.13") // slimmer version of 'org.mozilla:rhino'
|
implementation(libs.bundles.rhino)
|
||||||
implementation("org.mozilla:rhino-engine:1.7.13") // provides the same interface as 'javax.script' a.k.a Nashorn
|
|
||||||
|
|
||||||
// Kotlin wrapper around Java Preferences, makes certain things easier
|
// Kotlin wrapper around Java Preferences, makes certain things easier
|
||||||
val multiplatformSettingsVersion = "0.8"
|
implementation(libs.bundles.settings)
|
||||||
implementation("com.russhwolf:multiplatform-settings-jvm:$multiplatformSettingsVersion")
|
|
||||||
implementation("com.russhwolf:multiplatform-settings-serialization-jvm:$multiplatformSettingsVersion")
|
|
||||||
|
|
||||||
// Android version of SimpleDateFormat
|
// Android version of SimpleDateFormat
|
||||||
implementation("com.ibm.icu:icu4j:69.1")
|
implementation(libs.icu4j)
|
||||||
|
|
||||||
|
// OpenJDK lacks native JPEG encoder and native WEBP decoder
|
||||||
|
implementation(libs.bundles.twelvemonkeys)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,129 @@
|
|||||||
|
package android.graphics;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import javax.imageio.IIOImage;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.imageio.ImageWriteParam;
|
||||||
|
import javax.imageio.ImageWriter;
|
||||||
|
import javax.imageio.stream.ImageOutputStream;
|
||||||
|
|
||||||
|
public final class Bitmap {
|
||||||
|
private int width;
|
||||||
|
private int height;
|
||||||
|
private BufferedImage image;
|
||||||
|
|
||||||
|
public Bitmap(BufferedImage image) {
|
||||||
|
this.image = image;
|
||||||
|
this.width = image.getWidth();
|
||||||
|
this.height = image.getHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
public BufferedImage getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum CompressFormat {
|
||||||
|
JPEG (0),
|
||||||
|
PNG (1),
|
||||||
|
WEBP (2),
|
||||||
|
WEBP_LOSSY (3),
|
||||||
|
WEBP_LOSSLESS (4);
|
||||||
|
|
||||||
|
CompressFormat(int nativeInt) {
|
||||||
|
this.nativeInt = nativeInt;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int nativeInt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Config {
|
||||||
|
ALPHA_8(1),
|
||||||
|
RGB_565(3),
|
||||||
|
ARGB_4444(4),
|
||||||
|
ARGB_8888(5),
|
||||||
|
RGBA_F16(6),
|
||||||
|
HARDWARE(7),
|
||||||
|
RGBA_1010102(8);
|
||||||
|
|
||||||
|
final int nativeInt;
|
||||||
|
|
||||||
|
private static Config sConfigs[] = {
|
||||||
|
null, ALPHA_8, null, RGB_565, ARGB_4444, ARGB_8888, RGBA_F16, HARDWARE, RGBA_1010102
|
||||||
|
};
|
||||||
|
|
||||||
|
Config(int ni) {
|
||||||
|
this.nativeInt = ni;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Config nativeToConfig(int ni) {
|
||||||
|
return sConfigs[ni];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Bitmap createBitmap(int width, int height, Config config) {
|
||||||
|
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||||
|
return new Bitmap(image);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean compress(CompressFormat format, int quality, OutputStream stream) {
|
||||||
|
if (stream == null) {
|
||||||
|
throw new NullPointerException();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (quality < 0 || quality > 100) {
|
||||||
|
throw new IllegalArgumentException("quality must be 0..100");
|
||||||
|
}
|
||||||
|
float qualityFloat = ((float) quality) / 100;
|
||||||
|
|
||||||
|
String formatString = "";
|
||||||
|
if (format == Bitmap.CompressFormat.PNG) {
|
||||||
|
formatString = "png";
|
||||||
|
} else if (format == Bitmap.CompressFormat.JPEG) {
|
||||||
|
formatString = "jpg";
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("unsupported compression format!");
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName(formatString);
|
||||||
|
if (!writers.hasNext()) {
|
||||||
|
throw new IllegalStateException("no image writers found for this format!");
|
||||||
|
}
|
||||||
|
ImageWriter writer = (ImageWriter) writers.next();
|
||||||
|
|
||||||
|
ImageOutputStream ios;
|
||||||
|
try {
|
||||||
|
ios = ImageIO.createImageOutputStream(stream);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
writer.setOutput(ios);
|
||||||
|
|
||||||
|
ImageWriteParam param = writer.getDefaultWriteParam();
|
||||||
|
if (formatString == "jpg") {
|
||||||
|
param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
|
||||||
|
param.setCompressionQuality(qualityFloat);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
writer.write(null, new IIOImage(image, null, null), param);
|
||||||
|
ios.close();
|
||||||
|
writer.dispose();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package android.graphics;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.imageio.ImageReader;
|
||||||
|
import javax.imageio.stream.ImageInputStream;
|
||||||
|
|
||||||
|
public class BitmapFactory {
|
||||||
|
public static Bitmap decodeStream(InputStream inputStream) {
|
||||||
|
Bitmap bitmap = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
ImageInputStream imageInputStream = ImageIO.createImageInputStream(inputStream);
|
||||||
|
Iterator<ImageReader> imageReaders = ImageIO.getImageReaders(imageInputStream);
|
||||||
|
|
||||||
|
if (!imageReaders.hasNext()) {
|
||||||
|
throw new IllegalArgumentException("no reader for image");
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageReader imageReader = imageReaders.next();
|
||||||
|
imageReader.setInput(imageInputStream);
|
||||||
|
|
||||||
|
BufferedImage image = imageReader.read(0, imageReader.getDefaultReadParam());
|
||||||
|
bitmap = new Bitmap(image);
|
||||||
|
|
||||||
|
imageReader.dispose();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Bitmap decodeByteArray(byte[] data, int offset, int length) {
|
||||||
|
Bitmap bitmap = null;
|
||||||
|
|
||||||
|
ByteArrayInputStream byteArrayStream = new ByteArrayInputStream(data);
|
||||||
|
try {
|
||||||
|
BufferedImage image = ImageIO.read(byteArrayStream);
|
||||||
|
bitmap = new Bitmap(image);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package android.graphics;
|
||||||
|
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
|
public final class Canvas {
|
||||||
|
private BufferedImage canvasImage;
|
||||||
|
private Graphics2D canvas;
|
||||||
|
|
||||||
|
public Canvas(Bitmap bitmap) {
|
||||||
|
canvasImage = bitmap.getImage();
|
||||||
|
canvas = canvasImage.createGraphics();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawBitmap(Bitmap sourceBitmap, Rect src, Rect dst, Paint paint) {
|
||||||
|
BufferedImage sourceImage = sourceBitmap.getImage();
|
||||||
|
BufferedImage sourceImageCropped = sourceImage.getSubimage(src.left, src.top, src.getWidth(), src.getHeight());
|
||||||
|
canvas.drawImage(sourceImageCropped, null, dst.left, dst.top);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
package android.graphics;
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public final class Rect {
|
||||||
|
int left;
|
||||||
|
int top;
|
||||||
|
int right;
|
||||||
|
int bottom;
|
||||||
|
|
||||||
|
private static final class UnflattenHelper {
|
||||||
|
private static final Pattern FLATTENED_PATTERN = Pattern.compile(
|
||||||
|
"(-?\\d+) (-?\\d+) (-?\\d+) (-?\\d+)");
|
||||||
|
|
||||||
|
static Matcher getMatcher(String str) {
|
||||||
|
return FLATTENED_PATTERN.matcher(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rect() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rect(int left, int top, int right, int bottom) {
|
||||||
|
this.left = left;
|
||||||
|
this.top = top;
|
||||||
|
this.right = right;
|
||||||
|
this.bottom = bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rect(Rect r) {
|
||||||
|
if (r == null) {
|
||||||
|
this.left = 0;
|
||||||
|
this.top = 0;
|
||||||
|
this.right = 0;
|
||||||
|
this.bottom = 0;
|
||||||
|
} else {
|
||||||
|
this.left = left;
|
||||||
|
this.top = top;
|
||||||
|
this.right = right;
|
||||||
|
this.bottom = bottom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final int getWidth() {
|
||||||
|
return right - left;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final int getHeight() {
|
||||||
|
return bottom - top;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Rect unflattenFromString(String str) {
|
||||||
|
if (str.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Matcher matcher = UnflattenHelper.getMatcher(str);
|
||||||
|
if (!matcher.matches()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Rect(Integer.parseInt(matcher.group(1)),
|
||||||
|
Integer.parseInt(matcher.group(2)),
|
||||||
|
Integer.parseInt(matcher.group(3)),
|
||||||
|
Integer.parseInt(matcher.group(4)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toShortString() {
|
||||||
|
return toShortString(new StringBuilder(32));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toShortString(StringBuilder sb) {
|
||||||
|
sb.setLength(0);
|
||||||
|
sb.append('['); sb.append(left); sb.append(',');
|
||||||
|
sb.append(top); sb.append("]["); sb.append(right);
|
||||||
|
sb.append(','); sb.append(bottom); sb.append(']');
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String flattenToString() {
|
||||||
|
StringBuilder sb = new StringBuilder(32);
|
||||||
|
sb.append(left);
|
||||||
|
sb.append(' ');
|
||||||
|
sb.append(top);
|
||||||
|
sb.append(' ');
|
||||||
|
sb.append(right);
|
||||||
|
sb.append(' ');
|
||||||
|
sb.append(bottom);
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeToParcel(Parcel out, int flags) {
|
||||||
|
out.writeInt(left);
|
||||||
|
out.writeInt(top);
|
||||||
|
out.writeInt(right);
|
||||||
|
out.writeInt(bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Parcelable.Creator<Rect> CREATOR = new Parcelable.Creator<Rect>() {
|
||||||
|
@Override
|
||||||
|
public Rect createFromParcel(Parcel in) {
|
||||||
|
Rect r = new Rect();
|
||||||
|
r.readFromParcel(in);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rect[] newArray(int size) {
|
||||||
|
return new Rect[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public void readFromParcel(Parcel in) {
|
||||||
|
left = in.readInt();
|
||||||
|
top = in.readInt();
|
||||||
|
right = in.readInt();
|
||||||
|
bottom = in.readInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ package android.text;
|
|||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
import org.jsoup.safety.Whitelist;
|
import org.jsoup.safety.Safelist;
|
||||||
import org.xml.sax.XMLReader;
|
import org.xml.sax.XMLReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,7 +18,7 @@ import org.xml.sax.XMLReader;
|
|||||||
public class Html {
|
public class Html {
|
||||||
|
|
||||||
public static Spanned fromHtml(String source) {
|
public static Spanned fromHtml(String source) {
|
||||||
return new FakeSpanned(Jsoup.clean(source, Whitelist.none()));
|
return new FakeSpanned(Jsoup.clean(source, Safelist.none()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Spanned fromHtml(String source, Html.ImageGetter imageGetter, Html.TagHandler tagHandler) {
|
public static Spanned fromHtml(String source, Html.ImageGetter imageGetter, Html.TagHandler tagHandler) {
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package app.cash.quickjs;
|
||||||
|
|
||||||
|
import org.mozilla.javascript.ConsString;
|
||||||
|
import org.mozilla.javascript.NativeArray;
|
||||||
|
|
||||||
|
import javax.script.ScriptEngine;
|
||||||
|
import javax.script.ScriptEngineManager;
|
||||||
|
import java.io.Closeable;
|
||||||
|
|
||||||
|
public final class QuickJs implements Closeable {
|
||||||
|
private ScriptEngine engine;
|
||||||
|
|
||||||
|
public static QuickJs create() {
|
||||||
|
return new QuickJs(new ScriptEngineManager());
|
||||||
|
}
|
||||||
|
|
||||||
|
public QuickJs(ScriptEngineManager manager) {
|
||||||
|
this.engine = manager.getEngineByName("rhino");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object evaluate(String script, String fileName) {
|
||||||
|
return this.evaluate(script);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object evaluate(String script) {
|
||||||
|
try {
|
||||||
|
Object value = engine.eval(script);
|
||||||
|
return translateType(value);
|
||||||
|
} catch (Exception exception) {
|
||||||
|
throw new QuickJsException(exception.getMessage(), exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object translateType(Object obj) {
|
||||||
|
if (obj instanceof NativeArray) {
|
||||||
|
NativeArray array = (NativeArray) obj;
|
||||||
|
long length = array.getLength();
|
||||||
|
Object[] objects = new Object[(int) length];
|
||||||
|
for (int i = 0; i < (int) length; i++) {
|
||||||
|
objects[i] = translateType(array.get(i));
|
||||||
|
}
|
||||||
|
return objects;
|
||||||
|
}
|
||||||
|
if (obj instanceof ConsString) {
|
||||||
|
ConsString consString = (ConsString) obj;
|
||||||
|
return consString.toString();
|
||||||
|
}
|
||||||
|
if (obj instanceof Long) {
|
||||||
|
Long value = (Long) obj;
|
||||||
|
return value.intValue();
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] compile(String sourceCode, String fileName) {
|
||||||
|
return sourceCode.getBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Object execute(byte[] bytecode) {
|
||||||
|
return this.evaluate(new String(bytecode));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
this.engine = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package app.cash.quickjs;
|
||||||
|
|
||||||
|
public final class QuickJsException extends RuntimeException {
|
||||||
|
public QuickJsException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,9 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.android.internal.util;
|
package com.android.internal.util;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
|
||||||
import android.graphics.Bitmap.CompressFormat;
|
import android.graphics.Bitmap.CompressFormat;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
@@ -25,19 +26,14 @@ import android.util.Xml;
|
|||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
import org.xmlpull.v1.XmlSerializer;
|
import org.xmlpull.v1.XmlSerializer;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.ProtocolException;
|
import java.net.ProtocolException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
public class XmlUtils {
|
public class XmlUtils {
|
||||||
private static final String STRING_ARRAY_SEPARATOR = ":";
|
private static final String STRING_ARRAY_SEPARATOR = ":";
|
||||||
@@ -1396,9 +1392,9 @@ public class XmlUtils {
|
|||||||
} else if (tagName.equals("long")) {
|
} else if (tagName.equals("long")) {
|
||||||
return Long.valueOf(parser.getAttributeValue(null, "value"));
|
return Long.valueOf(parser.getAttributeValue(null, "value"));
|
||||||
} else if (tagName.equals("float")) {
|
} else if (tagName.equals("float")) {
|
||||||
return new Float(parser.getAttributeValue(null, "value"));
|
return Float.valueOf(parser.getAttributeValue(null, "value"));
|
||||||
} else if (tagName.equals("double")) {
|
} else if (tagName.equals("double")) {
|
||||||
return new Double(parser.getAttributeValue(null, "value"));
|
return Double.valueOf(parser.getAttributeValue(null, "value"));
|
||||||
} else if (tagName.equals("boolean")) {
|
} else if (tagName.equals("boolean")) {
|
||||||
return Boolean.valueOf(parser.getAttributeValue(null, "value"));
|
return Boolean.valueOf(parser.getAttributeValue(null, "value"));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -60,9 +60,13 @@ class ScrollableResultSet(val parent: ResultSet) : ResultSet by parent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun internalMove(row: Int) {
|
private fun internalMove(row: Int) {
|
||||||
if (cursor < 0) cursor = 0
|
if (cursor < 0) {
|
||||||
else if (cursor > resultSetLength + 1) cursor = resultSetLength + 1
|
cursor = 0
|
||||||
else cursor = row
|
} else if (cursor > resultSetLength + 1) {
|
||||||
|
cursor = resultSetLength + 1
|
||||||
|
} else {
|
||||||
|
cursor = row
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun obj(column: Int): Any? {
|
private fun obj(column: Int): Any? {
|
||||||
@@ -293,10 +297,11 @@ class ScrollableResultSet(val parent: ResultSet) : ResultSet by parent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun <T : Any?> unwrap(iface: Class<T>?): T {
|
override fun <T : Any?> unwrap(iface: Class<T>?): T {
|
||||||
if (thisIsWrapperFor(iface))
|
if (thisIsWrapperFor(iface)) {
|
||||||
return this as T
|
return this as T
|
||||||
else
|
} else {
|
||||||
return parent.unwrap(iface)
|
return parent.unwrap(iface)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun next(): Boolean {
|
override fun next(): Boolean {
|
||||||
@@ -531,10 +536,15 @@ class ScrollableResultSet(val parent: ResultSet) : ResultSet by parent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun castToLong(obj: Any?): Long {
|
private fun castToLong(obj: Any?): Long {
|
||||||
if (obj == null) return 0
|
if (obj == null) {
|
||||||
else if (obj is Long) return obj
|
return 0
|
||||||
else if (obj is Number) return obj.toLong()
|
} else if (obj is Long) {
|
||||||
else throw IllegalStateException("Object is not a long!")
|
return obj
|
||||||
|
} else if (obj is Number) {
|
||||||
|
return obj.toLong()
|
||||||
|
} else {
|
||||||
|
throw IllegalStateException("Object is not a long!")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getLong(columnIndex: Int): Long {
|
override fun getLong(columnIndex: Int): Long {
|
||||||
|
|||||||
+3
-3
@@ -10,7 +10,7 @@ package xyz.nulldev.androidcompat.io.sharedprefs
|
|||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import com.russhwolf.settings.ExperimentalSettingsApi
|
import com.russhwolf.settings.ExperimentalSettingsApi
|
||||||
import com.russhwolf.settings.ExperimentalSettingsImplementation
|
import com.russhwolf.settings.ExperimentalSettingsImplementation
|
||||||
import com.russhwolf.settings.JvmPreferencesSettings
|
import com.russhwolf.settings.PreferencesSettings
|
||||||
import com.russhwolf.settings.serialization.decodeValue
|
import com.russhwolf.settings.serialization.decodeValue
|
||||||
import com.russhwolf.settings.serialization.decodeValueOrNull
|
import com.russhwolf.settings.serialization.decodeValueOrNull
|
||||||
import com.russhwolf.settings.serialization.encodeValue
|
import com.russhwolf.settings.serialization.encodeValue
|
||||||
@@ -24,7 +24,7 @@ import java.util.prefs.Preferences
|
|||||||
@OptIn(ExperimentalSettingsImplementation::class, ExperimentalSerializationApi::class, ExperimentalSettingsApi::class)
|
@OptIn(ExperimentalSettingsImplementation::class, ExperimentalSerializationApi::class, ExperimentalSettingsApi::class)
|
||||||
class JavaSharedPreferences(key: String) : SharedPreferences {
|
class JavaSharedPreferences(key: String) : SharedPreferences {
|
||||||
private val javaPreferences = Preferences.userRoot().node("suwayomi/tachidesk/$key")
|
private val javaPreferences = Preferences.userRoot().node("suwayomi/tachidesk/$key")
|
||||||
private val preferences = JvmPreferencesSettings(javaPreferences)
|
private val preferences = PreferencesSettings(javaPreferences)
|
||||||
private val listeners = mutableMapOf<SharedPreferences.OnSharedPreferenceChangeListener, PreferenceChangeListener>()
|
private val listeners = mutableMapOf<SharedPreferences.OnSharedPreferenceChangeListener, PreferenceChangeListener>()
|
||||||
|
|
||||||
// TODO: 2021-05-29 Need to find a way to get this working with all pref types
|
// TODO: 2021-05-29 Need to find a way to get this working with all pref types
|
||||||
@@ -76,7 +76,7 @@ class JavaSharedPreferences(key: String) : SharedPreferences {
|
|||||||
return Editor(preferences)
|
return Editor(preferences)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Editor(private val preferences: JvmPreferencesSettings) : SharedPreferences.Editor {
|
class Editor(private val preferences: PreferencesSettings) : SharedPreferences.Editor {
|
||||||
val itemsToAdd = mutableMapOf<String, Any>()
|
val itemsToAdd = mutableMapOf<String, Any>()
|
||||||
|
|
||||||
override fun putString(key: String, value: String?): SharedPreferences.Editor {
|
override fun putString(key: String, value: String?): SharedPreferences.Editor {
|
||||||
|
|||||||
@@ -74,10 +74,11 @@ class PackageController {
|
|||||||
|
|
||||||
fun findPackage(packageName: String): InstalledPackage? {
|
fun findPackage(packageName: String): InstalledPackage? {
|
||||||
val file = File(androidFiles.packagesDir, packageName)
|
val file = File(androidFiles.packagesDir, packageName)
|
||||||
return if (file.exists())
|
return if (file.exists()) {
|
||||||
InstalledPackage(file)
|
InstalledPackage(file)
|
||||||
else
|
} else {
|
||||||
null
|
null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun findJarFromApk(apkFile: File): File? {
|
fun findJarFromApk(apkFile: File): File? {
|
||||||
|
|||||||
+267
@@ -1,3 +1,268 @@
|
|||||||
|
# Server: v0.6.6 + WebUI: r963
|
||||||
|
## TL;DR
|
||||||
|
- Batch actions for chapters
|
||||||
|
- Improved the downloader
|
||||||
|
- WebUI changes:
|
||||||
|
- Support for chapter actions
|
||||||
|
- a lot of code cleanup
|
||||||
|
- some bugfixes
|
||||||
|
|
||||||
|
## Tachidesk-Server Changelog
|
||||||
|
- (r1114) fix broken links (by @AriaMoradi)
|
||||||
|
- (r1115) fix more broken stuff (by @AriaMoradi)
|
||||||
|
- (r1116) fix more broken stuff (by @AriaMoradi)
|
||||||
|
- (r1117) fix more broken stuff (by @AriaMoradi)
|
||||||
|
- (r1118) Update winget.yml ([#393](https://github.com/Suwayomi/Tachidesk-Server/pull/393) by @vedantmgoyal2009)
|
||||||
|
- (r1119) fix jre path([#396](https://github.com/Suwayomi/Tachidesk-Server/pull/396) by @vedantmgoyal2009)
|
||||||
|
- (r1120) Fix deb package ([#397](https://github.com/Suwayomi/Tachidesk-Server/pull/397) by @mahor1221)
|
||||||
|
- (r1121) bump version (by @AriaMoradi)
|
||||||
|
- (r1122) Update Changelog (by @AriaMoradi)
|
||||||
|
- (r1123) Add libc++-dev ([#405](https://github.com/Suwayomi/Tachidesk-Server/pull/405) by @mahor1221)
|
||||||
|
- (r1124) Revert back to correct way of handling jre_dir ([#408](https://github.com/Suwayomi/Tachidesk-Server/pull/408) by @mahor1221)
|
||||||
|
- (r1125) Update winget.yml ([#410](https://github.com/Suwayomi/Tachidesk-Server/pull/410) by @vedantmgoyal2009)
|
||||||
|
- (r1126) Remove support for Sorayomi web interface ([#414](https://github.com/Suwayomi/Tachidesk-Server/pull/414) by @marcoebbinghaus)
|
||||||
|
- (r1127) Fix downloader memory leak ([#418](https://github.com/Suwayomi/Tachidesk-Server/pull/418) by @Syer10)
|
||||||
|
- (r1128) Documentation cleanup ([#417](https://github.com/Suwayomi/Tachidesk-Server/pull/417) by @Syer10)
|
||||||
|
- (r1129) Updater cleanup and improvements ([#416](https://github.com/Suwayomi/Tachidesk-Server/pull/416) by @Syer10)
|
||||||
|
- (r1130) replace quickjs with Mozilla Rhino ([#415](https://github.com/Suwayomi/Tachidesk-Server/pull/415) by @xhzhe)
|
||||||
|
- (r1131) ktlint (by @AriaMoradi)
|
||||||
|
- (r1132) move Tachiyomi's BuildConfig to kotlin dir (by @AriaMoradi)
|
||||||
|
- (r1133) remove BuildConfig as extensions now use AppInfo (by @AriaMoradi)
|
||||||
|
- (r1134) include list of mangas missing source in restore report ([#421](https://github.com/Suwayomi/Tachidesk-Server/pull/421) by @AriaMoradi)
|
||||||
|
- (r1135) Update dependencies ([#422](https://github.com/Suwayomi/Tachidesk-Server/pull/422) by @Syer10)
|
||||||
|
- (r1136) Lint ([#423](https://github.com/Suwayomi/Tachidesk-Server/pull/423) by @Syer10)
|
||||||
|
- (r1137) Fix: Error handling for popular/latest api if pageNum was supplied as zero ([#424](https://github.com/Suwayomi/Tachidesk-Server/pull/424) by @meta-boy)
|
||||||
|
- (r1138) Add cache control header to manga page response ([#430](https://github.com/Suwayomi/Tachidesk-Server/pull/430) by @martinek)
|
||||||
|
- (r1139) add MangaTable.lastFetchedAt and ChapterTable.chaptersLastFetchedAt ([#431](https://github.com/Suwayomi/Tachidesk-Server/pull/431) by @martinek)
|
||||||
|
- (r1140) Pre-load meta entries for all chapters for optimization ([#432](https://github.com/Suwayomi/Tachidesk-Server/pull/432) by @martinek)
|
||||||
|
- (r1141) POST variant for `/{sourceId}/search` endpoint ([#434](https://github.com/Suwayomi/Tachidesk-Server/pull/434) by @martinek)
|
||||||
|
- (r1142) Add request body to documentation ([#435](https://github.com/Suwayomi/Tachidesk-Server/pull/435) by @Syer10)
|
||||||
|
- (r1143) add batch download api ([#436](https://github.com/Suwayomi/Tachidesk-Server/pull/436) by @martinek)
|
||||||
|
- (r1144) Migrate to H2 v2 (by @AriaMoradi)
|
||||||
|
- (r1145) add category and global meta ([#438](https://github.com/Suwayomi/Tachidesk-Server/pull/438) by @AriaMoradi)
|
||||||
|
- (r1146) Revert H2 database to v1 (by @AriaMoradi)
|
||||||
|
- (r1147) refactor deprecated api (by @AriaMoradi)
|
||||||
|
- (r1148) Downloader Rewrite ([#437](https://github.com/Suwayomi/Tachidesk-Server/pull/437) by @Syer10)
|
||||||
|
- (r1149) Set source preference doc fix ([#441](https://github.com/Suwayomi/Tachidesk-Server/pull/441) by @Syer10)
|
||||||
|
- (r1150) Add batch chapter update endpoint ([#442](https://github.com/Suwayomi/Tachidesk-Server/pull/442) by @martinek)
|
||||||
|
- (r1151) changes needed for tachiyomi tracker (by @AriaMoradi)
|
||||||
|
- (r1152) Future proofing (by @AriaMoradi)
|
||||||
|
- (r1153) Fix settings/check-update endpoint ([#445](https://github.com/Suwayomi/Tachidesk-Server/pull/445) by @martinek)
|
||||||
|
- (r1154) Fix docs for /server/check-updates ([#447](https://github.com/Suwayomi/Tachidesk-Server/pull/447) by @martinek)
|
||||||
|
- (r1155) Batch editing and deleting any chapter ([#449](https://github.com/Suwayomi/Tachidesk-Server/pull/449) by @martinek)
|
||||||
|
- (r1156) make chapters endpoint more unifrom (by @AriaMoradi)
|
||||||
|
- (r1157) Add batch endpoint for removing downloads from download queue ([#452](https://github.com/Suwayomi/Tachidesk-Server/pull/452) by @martinek)
|
||||||
|
- (r1158) Download queue missing update fix ([#450](https://github.com/Suwayomi/Tachidesk-Server/pull/450) by @martinek)
|
||||||
|
|
||||||
|
## Tachidesk-WebUI Changelog
|
||||||
|
- (r947) Feature/swr for library screens ([#186](https://github.com/Suwayomi/Tachidesk-WebUI/pull/186) by @martinek)
|
||||||
|
- (r948) Feature/swr for simple queries ([#187](https://github.com/Suwayomi/Tachidesk-WebUI/pull/187) by @martinek)
|
||||||
|
- (r949) Check download queue for changes and reload chapters if any chapter download changes state. ([#189](https://github.com/Suwayomi/Tachidesk-WebUI/pull/189) by @martinek)
|
||||||
|
- (r950) Update typescript dependency ([#190](https://github.com/Suwayomi/Tachidesk-WebUI/pull/190) by @martinek)
|
||||||
|
- (r951) update browserlist (by @AriaMoradi)
|
||||||
|
- (r952) Feature/batch chapter download ([#191](https://github.com/Suwayomi/Tachidesk-WebUI/pull/191) by @martinek)
|
||||||
|
- (r953) Memoize empty view face so it does not change on rerender ([#193](https://github.com/Suwayomi/Tachidesk-WebUI/pull/193) by @martinek)
|
||||||
|
- (r954) Feature/batch chapter actions ([#194](https://github.com/Suwayomi/Tachidesk-WebUI/pull/194) by @martinek)
|
||||||
|
- (r955) Fix navbar back button behavior ([#195](https://github.com/Suwayomi/Tachidesk-WebUI/pull/195) by @martinek)
|
||||||
|
- (r956) Options panels refactoring ([#196](https://github.com/Suwayomi/Tachidesk-WebUI/pull/196) by @martinek)
|
||||||
|
- (r957) Refactor and fix sorting in library ([#197](https://github.com/Suwayomi/Tachidesk-WebUI/pull/197) by @martinek)
|
||||||
|
- (r958) Scroll window to top when PagedPager changes page ([#198](https://github.com/Suwayomi/Tachidesk-WebUI/pull/198) by @martinek)
|
||||||
|
- (r959) Verticall scroll navigation and fix ([#200](https://github.com/Suwayomi/Tachidesk-WebUI/pull/200) by @martinek)
|
||||||
|
- (r960) Hide overflowing text in reader title if text can't be wrapped ([#199](https://github.com/Suwayomi/Tachidesk-WebUI/pull/199) by @martinek)
|
||||||
|
- (r961) Add safezone to scroll end detection to prevent edge cases when scrolling to the end would not detect end ([#201](https://github.com/Suwayomi/Tachidesk-WebUI/pull/201) by @martinek)
|
||||||
|
- (r962) Refactor/download queue and cleanup visuals overall ([#202](https://github.com/Suwayomi/Tachidesk-WebUI/pull/202) by @martinek)
|
||||||
|
- (r963) Fix "back" pagination on double page layout in reader for spread pages ([#203](https://github.com/Suwayomi/Tachidesk-WebUI/pull/203) by @martinek)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Server: v0.6.5 + WebUI: r946
|
||||||
|
## TL;DR
|
||||||
|
- Fixed Windows bundler
|
||||||
|
|
||||||
|
## Tachidesk-Server Changelog
|
||||||
|
- (r1113) v0.6.4 (by @AriaMoradi)
|
||||||
|
- (r1114) fix broken links (by @AriaMoradi)
|
||||||
|
- (r1115) fix more broken stuff (by @AriaMoradi)
|
||||||
|
- (r1116) fix more broken stuff (by @AriaMoradi)
|
||||||
|
- (r1117) fix more broken stuff (by @AriaMoradi)
|
||||||
|
- (r1118) Update winget.yml ([#393](https://github.com/Suwayomi/Tachidesk-Server/pull/393) by @vedantmgoyal2009)
|
||||||
|
- (r1119) fix jre path([#396](https://github.com/Suwayomi/Tachidesk-Server/pull/396) by @voltrare)
|
||||||
|
- (r1120) Fix deb package ([#397](https://github.com/Suwayomi/Tachidesk-Server/pull/397) by @mahor1221)
|
||||||
|
- (r1121) bump version (by @AriaMoradi)
|
||||||
|
|
||||||
|
## Tachidesk-WebUI Changelog
|
||||||
|
- None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Server: v0.6.4 + WebUI: r946
|
||||||
|
## TL;DR
|
||||||
|
- No new major features
|
||||||
|
- Bug fixes and changes for packaging
|
||||||
|
- Documentation changes
|
||||||
|
|
||||||
|
## Tachidesk-Server Changelog
|
||||||
|
- (r1087) v0.6.3 (by @AriaMoradi)
|
||||||
|
- (r1088) Save categories when manga is unfavorited ([#335](https://github.com/Suwayomi/Tachidesk-Server/pull/335) by @Syer10)
|
||||||
|
- (r1089) handle solid RAR archives ([#339](https://github.com/Suwayomi/Tachidesk-Server/pull/339)) cfso100@gmail.com
|
||||||
|
- (r1090) add support for changing downloads dir ([#343](https://github.com/Suwayomi/Tachidesk-Server/pull/343) by @AriaMoradi)
|
||||||
|
- (r1091) fix Applications dir dependency ([#344](https://github.com/Suwayomi/Tachidesk-Server/pull/344) by @AriaMoradi)
|
||||||
|
- (r1092) add support for alternative web interfaces ([#342](https://github.com/Suwayomi/Tachidesk-Server/pull/342) by @AriaMoradi)
|
||||||
|
- (r1093) Add displayValues json field for select filter ([#347](https://github.com/Suwayomi/Tachidesk-Server/pull/347) by @Syer10)
|
||||||
|
- (r1094) document manga endpoints ([#348](https://github.com/Suwayomi/Tachidesk-Server/pull/348) by @Syer10)
|
||||||
|
- (r1095) add ChapterCount to manga object in categoryMangas endpoint ([#349](https://github.com/Suwayomi/Tachidesk-Server/pull/349) by @abhijeetChawla)
|
||||||
|
- (r1096) document all endpoints ([#350](https://github.com/Suwayomi/Tachidesk-Server/pull/350) by @Syer10)
|
||||||
|
- (r1097) fix copymanga ([#354](https://github.com/Suwayomi/Tachidesk-Server/pull/354) by @AriaMoradi)
|
||||||
|
- (r1098) fix formatting by kotlinter (by @AriaMoradi)
|
||||||
|
- (r1099) bump WebUI (by @AriaMoradi)
|
||||||
|
- (r1100) fix WebUI release name (by @AriaMoradi)
|
||||||
|
- (r1101) Fix documentation errors ([#358](https://github.com/Suwayomi/Tachidesk-Server/pull/358) by @Syer10)
|
||||||
|
- (r1102) Docs improvements ([#359](https://github.com/Suwayomi/Tachidesk-Server/pull/359) by @Syer10)
|
||||||
|
- (r1103) Add linux-all.tar.gz & systemd service ([#366](https://github.com/Suwayomi/Tachidesk-Server/pull/366) by @mahor1221)
|
||||||
|
- (r1104) Publish to Windows Package Managar (WinGet) ([#369](https://github.com/Suwayomi/Tachidesk-Server/pull/369) by @vedantmgoyal2009)
|
||||||
|
- (r1105) Refactor scripts ([#370](https://github.com/Suwayomi/Tachidesk-Server/pull/370) by @mahor1221)
|
||||||
|
- (r1106) Run workflow jobs toghether ([#371](https://github.com/Suwayomi/Tachidesk-Server/pull/371) by @mahor1221)
|
||||||
|
- (r1107) Update gradle action ([#372](https://github.com/Suwayomi/Tachidesk-Server/pull/372) by @mahor1221)
|
||||||
|
- (r1108) Improve DocumentationDsl, bugfix default values and add queryParams ([#378](https://github.com/Suwayomi/Tachidesk-Server/pull/378) by @Syer10)
|
||||||
|
- (r1109) Tidy up bundler script ([#380](https://github.com/Suwayomi/Tachidesk-Server/pull/380) by @mahor1221)
|
||||||
|
- (r1110) Replace linux-all with linux-assets ([#381](https://github.com/Suwayomi/Tachidesk-Server/pull/381) by @mahor1221)
|
||||||
|
- (r1111) Rename every instance of Tachidesk jar to Tachdidesk-Server.jar ([#384](https://github.com/Suwayomi/Tachidesk-Server/pull/384) by @AriaMoradi)
|
||||||
|
- (r1112) Fix mistakes from #384 ([#385](https://github.com/Suwayomi/Tachidesk-Server/pull/385) by @AriaMoradi)
|
||||||
|
|
||||||
|
## Tachidesk-WebUI Changelog
|
||||||
|
- (r943) fix default width ([#171](https://github.com/Suwayomi/Tachidesk-WebUI/pull/171) by @Robonau)
|
||||||
|
- (r944) added an update checker button for library ([#172](https://github.com/Suwayomi/Tachidesk-WebUI/pull/172) by @infix)
|
||||||
|
- (r945) fix download queue delete button ([#176](https://github.com/Suwayomi/Tachidesk-WebUI/pull/176) by @Kreach37)
|
||||||
|
- (r946) fix mangadex filters ([#177](https://github.com/Suwayomi/Tachidesk-WebUI/pull/177) by @Robonau)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Server: v0.6.3 + WebUI: r942
|
||||||
|
## TL;DR
|
||||||
|
- Changes in Server
|
||||||
|
- Support for array search filter changes list
|
||||||
|
- Support for Tachiyomi extensions lib 1.3
|
||||||
|
- Changes in WebUI
|
||||||
|
- Better search filter support
|
||||||
|
- Fluid manga grid
|
||||||
|
- Library comfortable grid
|
||||||
|
- Sources view layouts
|
||||||
|
- Various other changes...
|
||||||
|
|
||||||
|
## Tachidesk-Server Changelog
|
||||||
|
- (r1074) v0.6.2 (by @AriaMoradi)
|
||||||
|
- (r1075) support array filter changes ([#304](https://github.com/Suwayomi/Tachidesk-Server/pull/304) by @AriaMoradi)
|
||||||
|
- (r1076) fix filterlist bugs ([#306](https://github.com/Suwayomi/Tachidesk-Server/pull/306) by @AriaMoradi)
|
||||||
|
- (r1077) Update README.md ([#305](https://github.com/Suwayomi/Tachidesk-Server/pull/305) by @mahor1221)
|
||||||
|
- (r1078) fix meta update changing all keys ([#314](https://github.com/Suwayomi/Tachidesk-Server/pull/314) by @AriaMoradi)
|
||||||
|
- (r1079) add support for tachiyomi extensions Lib 1.3 ([#316](https://github.com/Suwayomi/Tachidesk-Server/pull/316) by @AriaMoradi)
|
||||||
|
- (r1080) Fix sources list of one source throws an exception ([#308](https://github.com/Suwayomi/Tachidesk-Server/pull/308) by @Syer10)
|
||||||
|
- (r1081) Improve source handling, fix errors with uninitialized mangas in broken sources ([#319](https://github.com/Suwayomi/Tachidesk-Server/pull/319) by @Syer10)
|
||||||
|
- (r1082) Add thumbnail support for stub sources ([#320](https://github.com/Suwayomi/Tachidesk-Server/pull/320) by @Syer10)
|
||||||
|
- (r1083) update description for Tachidesk-Sorayomi ([#326](https://github.com/Suwayomi/Tachidesk-Server/pull/326) by @DattatreyaReddy)
|
||||||
|
- (r1084) Add last bit of code needed for Extensions Lib 1.3 ([#330](https://github.com/Suwayomi/Tachidesk-Server/pull/330) by @Syer10)
|
||||||
|
- (r1085) Add QuickJS, replaces Duktape for Extensions Lib 1.3 ([#331](https://github.com/Suwayomi/Tachidesk-Server/pull/331) by @Syer10)
|
||||||
|
- (r1086) fix auth not actually blocking requests ([#333](https://github.com/Suwayomi/Tachidesk-Server/pull/333) by @AriaMoradi)
|
||||||
|
|
||||||
|
## Tachidesk-WebUI Changelog
|
||||||
|
- (r930) Source filter scroll fix (array of filters on submit [#149](https://github.com/Suwayomi/Tachidesk-WebUI/pull/149) by @Robonau)
|
||||||
|
- (r931) fix manga badges setting menu that turns the update/download badges on and off ([#150](https://github.com/Suwayomi/Tachidesk-WebUI/pull/150) by @Robonau)
|
||||||
|
- (r932) move sorts to copy tachiyomi ([#151](https://github.com/Suwayomi/Tachidesk-WebUI/pull/151) by @Robonau)
|
||||||
|
- (r933) add comfortable grid option ([#152](https://github.com/Suwayomi/Tachidesk-WebUI/pull/152) by @Robonau)
|
||||||
|
- (r934) source layouts ([#153](https://github.com/Suwayomi/Tachidesk-WebUI/pull/153) by @Robonau)
|
||||||
|
- (r935) List layout ([#154](https://github.com/Suwayomi/Tachidesk-WebUI/pull/154) by @Robonau)
|
||||||
|
- (r936) in library badge to manga in sources ([#156](https://github.com/Suwayomi/Tachidesk-WebUI/pull/156) by @Robonau)
|
||||||
|
- (r937) mass search ([#157](https://github.com/Suwayomi/Tachidesk-WebUI/pull/157) by @Robonau)
|
||||||
|
- (r938) 18+ tag on source/extension cards ([#160](https://github.com/Suwayomi/Tachidesk-WebUI/pull/160) by @Robonau)
|
||||||
|
- (r939) fix search source click ([#164](https://github.com/Suwayomi/Tachidesk-WebUI/pull/164) by @Robonau)
|
||||||
|
- (r940) items per row setting ([#165](https://github.com/Suwayomi/Tachidesk-WebUI/pull/165) by @Robonau)
|
||||||
|
- (r941) fix the grid width thing ([#169](https://github.com/Suwayomi/Tachidesk-WebUI/pull/169) by @Robonau)
|
||||||
|
- (r942) unified library options ([#168](https://github.com/Suwayomi/Tachidesk-WebUI/pull/168) by @infix)
|
||||||
|
|
||||||
|
# Server: v0.6.2 + WebUI: r929
|
||||||
|
## TL;DR
|
||||||
|
- Changes in WebUI
|
||||||
|
- Moved search to Browse
|
||||||
|
- Support for Source Filters
|
||||||
|
- Better visuals for Download Queue
|
||||||
|
- A live version of WebUI is now available [at this link](https://tachidesk-webui-preview.github.io/).
|
||||||
|
|
||||||
|
## Tachidesk-Server Changelog
|
||||||
|
- (r1073) Refactor debian-packager.sh, rename launcher scripts ([#303](https://github.com/Suwayomi/Tachidesk-Server/pull/303) by @mahor1221)
|
||||||
|
|
||||||
|
## Tachidesk-WebUI Changelog
|
||||||
|
- (r912) show locale date, less confusing ([#131](https://github.com/Suwayomi/Tachidesk-WebUI/pull/131) by @AriaMoradi)
|
||||||
|
- (r913) fix links to work on a bare host ([#132](https://github.com/Suwayomi/Tachidesk-WebUI/pull/132) by @AriaMoradi)
|
||||||
|
- (r914) fix direct links ([#133](https://github.com/Suwayomi/Tachidesk-WebUI/pull/133) by @AriaMoradi)
|
||||||
|
- (r915) deploy to github pages (by @AriaMoradi)
|
||||||
|
- (r916) fix typo (by @AriaMoradi)
|
||||||
|
- (r917) better naming (by @AriaMoradi)
|
||||||
|
- (r918) update notice about github pages (by @AriaMoradi)
|
||||||
|
- (r919) move text (by @AriaMoradi)
|
||||||
|
- (r920) make all links work by catching 404 (by @AriaMoradi)
|
||||||
|
- (r921) fix scrolling 8px ([#135](https://github.com/Suwayomi/Tachidesk-WebUI/pull/135) by @Robonau)
|
||||||
|
- (r922) sorting ([#136](https://github.com/Suwayomi/Tachidesk-WebUI/pull/136) by @Robonau)
|
||||||
|
- (r923) Close button fix ([#141](https://github.com/Suwayomi/Tachidesk-WebUI/pull/141)) z14942744@gmail.com
|
||||||
|
- (r924) add NavBarContextProvider ([#128](https://github.com/Suwayomi/Tachidesk-WebUI/pull/128) by @abhijeetChawla)
|
||||||
|
- (r925) Resolved Merged Conflicts ([#127](https://github.com/Suwayomi/Tachidesk-WebUI/pull/127) by @abhijeetChawla)
|
||||||
|
- (r926) more Download Queue info ([#138](https://github.com/Suwayomi/Tachidesk-WebUI/pull/138) by @Robonau)
|
||||||
|
- (r927) Source filters, move search to SourceMangas ([#142](https://github.com/Suwayomi/Tachidesk-WebUI/pull/142) by @Robonau)
|
||||||
|
- (r928) Source genre sorts design ([#147](https://github.com/Suwayomi/Tachidesk-WebUI/pull/147) by @Robonau)
|
||||||
|
- (r929) Update LibraryOptions.tsx ([#146](https://github.com/Suwayomi/Tachidesk-WebUI/pull/146) by @Robonau)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Server: v0.6.1 + WebUI: r911
|
||||||
|
## TL;DR
|
||||||
|
- msi and deb packages thanks to @mahor1221
|
||||||
|
- [Tachidesk-Flutter](https://github.com/Suwayomi/Tachidesk-Flutter) exists now!
|
||||||
|
|
||||||
|
## Tachidesk-Server Changelog
|
||||||
|
- (r1047) update (by @AriaMoradi)
|
||||||
|
- (r1048) bump version (by @AriaMoradi)
|
||||||
|
- (r1049) Update README.md (by @AriaMoradi)
|
||||||
|
- (r1050) Update README.md (by @AriaMoradi)
|
||||||
|
- (r1051) refactor getChapter ([#268](https://github.com/Suwayomi/Tachidesk-Server/pull/268) by @AriaMoradi)
|
||||||
|
- (r1052) Improve documentation with Http codes ([#261](https://github.com/Suwayomi/Tachidesk-Server/pull/261) by @Syer10)
|
||||||
|
- (r1053) Add Route to stop and reset the updater ([#260](https://github.com/Suwayomi/Tachidesk-Server/pull/260) by @ntbm)
|
||||||
|
- (r1054) ignore non image files ([#269](https://github.com/Suwayomi/Tachidesk-Server/pull/269) by @AriaMoradi)
|
||||||
|
- (r1055) fix compile erorr (by @AriaMoradi)
|
||||||
|
- (r1056) update dex2jar (by @AriaMoradi)
|
||||||
|
- (r1057) Update Gradle and Dependencies ([#281](https://github.com/Suwayomi/Tachidesk-Server/pull/281) by @Syer10)
|
||||||
|
- (r1058) Handlers must return a result ([#282](https://github.com/Suwayomi/Tachidesk-Server/pull/282) by @Syer10)
|
||||||
|
- (r1059) Allow app compilation on Java 18+ ([#286](https://github.com/Suwayomi/Tachidesk-Server/pull/286) by @Syer10)
|
||||||
|
- (r1060) Automated MSI package building ([#277](https://github.com/Suwayomi/Tachidesk-Server/pull/277) by @mahor1221)
|
||||||
|
- (r1061) Automated debian package building ([#287](https://github.com/Suwayomi/Tachidesk-Server/pull/287) by @mahor1221)
|
||||||
|
- (r1062) fix Debian package errors ([#288](https://github.com/Suwayomi/Tachidesk-Server/pull/288) by @mahor1221)
|
||||||
|
- (r1063) Fix build_push.yml Hopefully ([#289](https://github.com/Suwayomi/Tachidesk-Server/pull/289) by @mahor1221)
|
||||||
|
- (r1064) Improve windows-bundler.sh ([#290](https://github.com/Suwayomi/Tachidesk-Server/pull/290) by @mahor1221)
|
||||||
|
- (r1065) add Tachidesk-Flutter to readme ([#292](https://github.com/Suwayomi/Tachidesk-Server/pull/292)) @DattatreyaReddy)
|
||||||
|
- (r1066) no online fetch on backup ([#293](https://github.com/Suwayomi/Tachidesk-Server/pull/293) by @AriaMoradi)
|
||||||
|
- (r1067) auto-remove duplicate chapters ([#294](https://github.com/Suwayomi/Tachidesk-Server/pull/294) by @AriaMoradi)
|
||||||
|
- (r1068) remove gson ([#295](https://github.com/Suwayomi/Tachidesk-Server/pull/295) by @AriaMoradi)
|
||||||
|
|
||||||
|
## Tachidesk-WebUI Changelog
|
||||||
|
- (r894) migrate ReaderNavbar to Mui 5 ([#84](https://github.com/Suwayomi/Tachidesk-WebUI/pull/84) by @AriaMoradi)
|
||||||
|
- (r895) migrate SpinnerImage to Mui 5 ([#97](https://github.com/Suwayomi/Tachidesk-WebUI/pull/97) by @AriaMoradi)
|
||||||
|
- (r896) migrate VerticalPager to Mui 5 ([#94](https://github.com/Suwayomi/Tachidesk-WebUI/pull/94) by @AriaMoradi)
|
||||||
|
- (r897) migrate PagedPager to Mui 5 ([#93](https://github.com/Suwayomi/Tachidesk-WebUI/pull/93) by @AriaMoradi)
|
||||||
|
- (r898) MangaCard imges don't stretch now ([#110](https://github.com/Suwayomi/Tachidesk-WebUI/pull/110) by @abhijeetChawla)
|
||||||
|
- (r899) show correct title ([#111](https://github.com/Suwayomi/Tachidesk-WebUI/pull/111) by @AriaMoradi)
|
||||||
|
- (r900) migrate DoublePage to Mui 5 ([#88](https://github.com/Suwayomi/Tachidesk-WebUI/pull/88) by @AriaMoradi)
|
||||||
|
- (r901) migrate DoublePagedPager to Mui 5 ([#91](https://github.com/Suwayomi/Tachidesk-WebUI/pull/91) by @AriaMoradi)
|
||||||
|
- (r902) migrate Reader to Mui 5 ([#100](https://github.com/Suwayomi/Tachidesk-WebUI/pull/100) by @AriaMoradi)
|
||||||
|
- (r903) migrate HorizantalPager to Mui 5 ([#92](https://github.com/Suwayomi/Tachidesk-WebUI/pull/92) by @AriaMoradi)
|
||||||
|
- (r904) migrate PageNumber to Mui 5 ([#90](https://github.com/Suwayomi/Tachidesk-WebUI/pull/90) by @AriaMoradi)
|
||||||
|
- (r905) Chapter filter is woking ([#114](https://github.com/Suwayomi/Tachidesk-WebUI/pull/114) by @abhijeetChawla)
|
||||||
|
- (r906) added extension search ([#115](https://github.com/Suwayomi/Tachidesk-WebUI/pull/115) by @abhijeetChawla)
|
||||||
|
- (r907) cleanup ([#117](https://github.com/Suwayomi/Tachidesk-WebUI/pull/117) by @AriaMoradi)
|
||||||
|
- (r908) handle search shortcuts ([#116](https://github.com/Suwayomi/Tachidesk-WebUI/pull/116) by @AriaMoradi)
|
||||||
|
- (r909) Refactor for Removing unnecesary UseEffect ([#118](https://github.com/Suwayomi/Tachidesk-WebUI/pull/118) by @abhijeetChawla)
|
||||||
|
- (r910) refactor ChapterList ([#125](https://github.com/Suwayomi/Tachidesk-WebUI/pull/125) by @abhijeetChawla)
|
||||||
|
- (r911) refactor ChapterOptions ([#126](https://github.com/Suwayomi/Tachidesk-WebUI/pull/126) by @abhijeetChawla)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Server: v0.6.0 + WebUI: r893
|
# Server: v0.6.0 + WebUI: r893
|
||||||
## TL;DR
|
## TL;DR
|
||||||
- WebUI design went through a whole lot of changes, including
|
- WebUI design went through a whole lot of changes, including
|
||||||
@@ -125,6 +390,8 @@
|
|||||||
- (r892) add support for emptySearch ([#109](https://github.com/Suwayomi/Tachidesk-WebUI/pull/109) by @AriaMoradi)
|
- (r892) add support for emptySearch ([#109](https://github.com/Suwayomi/Tachidesk-WebUI/pull/109) by @AriaMoradi)
|
||||||
- (r893) add support for MultiSelectListPreference ([#108](https://github.com/Suwayomi/Tachidesk-WebUI/pull/108) by @AriaMoradi)
|
- (r893) add support for MultiSelectListPreference ([#108](https://github.com/Suwayomi/Tachidesk-WebUI/pull/108) by @AriaMoradi)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Server: v0.5.4 + WebUI: r820
|
# Server: v0.5.4 + WebUI: r820
|
||||||
## TL;DR
|
## TL;DR
|
||||||
- Fixed ReadComicOnline, Toonily and possibly other sources not working
|
- Fixed ReadComicOnline, Toonily and possibly other sources not working
|
||||||
|
|||||||
@@ -34,22 +34,22 @@ A free and open source manga reader server that runs extensions built for [Tachi
|
|||||||
|
|
||||||
Tachidesk is an independent Tachiyomi compatible software and is **not a Fork of** Tachiyomi.
|
Tachidesk is an independent Tachiyomi compatible software and is **not a Fork of** Tachiyomi.
|
||||||
|
|
||||||
`Tachidesk` is a general term used to describe the combination of Tachidesk-Server(this project) and one of our clients.
|
|
||||||
Think of it roughly like the concept of "distribution" in GNU/Linux distributions, in which Linux(Tachidesk-Server) is the kernel and the difference is which desktop environment(Tachidesk client) you get with it.
|
|
||||||
|
|
||||||
Tachidesk-Server is as multi-platform as you can get. Any platform that runs java and/or has a modern browser can run it. This includes Windows, Linux, macOS, chrome OS, etc. Follow [Downloading and Running the app](#downloading-and-running-the-app) for installation instructions.
|
Tachidesk-Server is as multi-platform as you can get. Any platform that runs java and/or has a modern browser can run it. This includes Windows, Linux, macOS, chrome OS, etc. Follow [Downloading and Running the app](#downloading-and-running-the-app) for installation instructions.
|
||||||
|
|
||||||
Ability to sync with Tachiyomi is a planned feature.
|
Ability to sync with Tachiyomi is a planned feature, for more info look [here](#syncing-with-tachiyomi).
|
||||||
|
|
||||||
# Tachidesk client projects
|
# Tachidesk client projects
|
||||||
**You need a client/user interface app as a front-end for Tachidesk-Server, if you Directly Download Tachidesk-Server you'll get a bundled version of [Tachidesk-WebUI](https://github.com/Suwayomi/Tachidesk-WebUI) with it.**
|
**You need a client/user interface app as a front-end for Tachidesk-Server, if you [Directly Download Tachidesk-Server](https://github.com/Suwayomi/Tachidesk-Server/releases/latest) you'll get a bundled version of [Tachidesk-WebUI](https://github.com/Suwayomi/Tachidesk-WebUI) with it.**
|
||||||
|
|
||||||
Here's a list of known clients/user interfaces for Tachidesk-Server:
|
Here's a list of known clients/user interfaces for Tachidesk-Server:
|
||||||
- [Tachidesk-WebUI](https://github.com/Suwayomi/Tachidesk-WebUI): The web/ElectronJS front-end that Tachidesk-Server is traditionally shipped with. Usually gets new features faster.
|
##### Actively Developed Cients
|
||||||
- [Tachidesk-JUI](https://github.com/Suwayomi/Tachidesk-JUI): The native desktop front-end for Tachidesk-Server. Currently the most advanced. Downlading Tachidesk-JUI is not recommened for now, the current release is getting obsolete, a new version is to be released soon(TM).
|
- [Tachidesk-WebUI](https://github.com/Suwayomi/Tachidesk-WebUI): The web/ElectronJS front-end that Tachidesk-Server ships with by default.
|
||||||
- [Tachidesk-qtui](https://github.com/Suwayomi/Tachidesk-qtui): A C++/Qt front-end for mobile devices(Android/linux), in super early stage of development.
|
- [Tachidesk-JUI](https://github.com/Suwayomi/Tachidesk-JUI): The native desktop front-end for Tachidesk-Server. Currently the most advanced.
|
||||||
- [Tachidesk-GTK](https://github.com/mahor1221/Tachidesk-GTK): A native Rust/GTK desktop client, in super early stage of development.
|
- [Tachidesk-qtui](https://github.com/Suwayomi/Tachidesk-qtui): A C++/Qt front-end for mobile devices(Android/linux), feature support is basic.
|
||||||
- [Equinox](https://github.com/Suwayomi/Equinox): A web user interface made with Vue.js, in super early stage of development. Seemingly abandoned.
|
- [Tachidesk-Sorayomi](https://github.com/Suwayomi/Tachidesk-Sorayomi): A Flutter front-end for Desktop(Linux, windows, etc.), Web and Android with a User Inerface inspired by Tachiyomi.
|
||||||
|
##### Inctive/Abandoned Cients
|
||||||
|
- [Equinox](https://github.com/Suwayomi/Equinox): A web user interface made with Vue.js.
|
||||||
|
- [Tachidesk-GTK](https://github.com/mahor1221/Tachidesk-GTK): A native Rust/GTK desktop client.
|
||||||
|
|
||||||
## Is this application usable? Should I test it?
|
## Is this application usable? Should I test it?
|
||||||
Here is a list of current features:
|
Here is a list of current features:
|
||||||
@@ -77,33 +77,40 @@ If a bundle for your operating system or cpu architecture is not provided then r
|
|||||||
**Node:** Linux launcher scripts are named a bit differently but work the same.
|
**Node:** Linux launcher scripts are named a bit differently but work the same.
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
Download the latest `win32`(Windows 32-bit) or `win64`(Windows 64-bit) release from [the releases section](https://github.com/Suwayomi/Tachidesk/releases) or a preview one from [the preview repository](https://github.com/Suwayomi/Tachidesk-preview/releases).
|
Download the latest `win32`(Windows 32-bit) or `win64`(Windows 64-bit) release from [the releases section](https://github.com/Suwayomi/Tachidesk-Server/releases) or a preview one from [the preview repository](https://github.com/Suwayomi/Tachidesk-Server-preview/releases).
|
||||||
|
|
||||||
Unzip the downloaded file and double click on one of the launcher scripts.
|
Unzip the downloaded file and double click on one of the launcher scripts.
|
||||||
|
|
||||||
### macOS
|
### macOS
|
||||||
Download the latest `macOS-x64`(older macOS systems) or `macOS-arm64`(Apple M1) release from [the releases section](https://github.com/Suwayomi/Tachidesk/releases) or a preview one from [the preview repository](https://github.com/Suwayomi/Tachidesk-preview/releases).
|
Download the latest `macOS-x64`(older macOS systems) or `macOS-arm64`(Apple M1 and newer) release from [the releases section](https://github.com/Suwayomi/Tachidesk-Server/releases) or a preview one from [the preview repository](https://github.com/Suwayomi/Tachidesk-Server-preview/releases).
|
||||||
|
|
||||||
Unzip the downloaded file and double click on one of the launcher scripts.
|
Unzip the downloaded file and double click on one of the launcher scripts.
|
||||||
|
|
||||||
### GNU/Linux
|
### GNU/Linux
|
||||||
Download the latest `linux-x64`(x86_64) release from [the releases section](https://github.com/Suwayomi/Tachidesk/releases) or a preview one from [the preview repository](https://github.com/Suwayomi/Tachidesk-preview/releases).
|
Download the latest `linux-x64`(x86_64) release from [the releases section](https://github.com/Suwayomi/Tachidesk-Server/releases) or a preview one from [the preview repository](https://github.com/Suwayomi/Tachidesk-Server-preview/releases).
|
||||||
|
|
||||||
`tar xvf` the downloaded file and double click on one of the launcher scripts or run them using the terminal.
|
`tar xvf` the downloaded file and double click on one of the launcher scripts or run them using the terminal.
|
||||||
|
|
||||||
## Other methods of getting Tachidesk
|
## Other methods of getting Tachidesk
|
||||||
### Arch Linux
|
### Arch Linux
|
||||||
You can install Tachidesk from the AUR
|
You can install Tachidesk from the AUR:
|
||||||
```
|
```
|
||||||
yay -S tachidesk
|
yay -S tachidesk
|
||||||
```
|
```
|
||||||
|
|
||||||
### Ubuntu-based distributions
|
### Debian/Ubuntu
|
||||||
More information can be found on the [PPA's page](https://launchpad.net/~suwayomi/+archive/ubuntu/tachidesk).
|
Download the latest deb package from the release section or Install from the MPR
|
||||||
```
|
```
|
||||||
sudo add-apt-repository ppa:suwayomi/tachidesk
|
git clone https://mpr.makedeb.org/tachidesk-server.git
|
||||||
|
cd tachidesk-server
|
||||||
|
makedeb -si
|
||||||
|
```
|
||||||
|
|
||||||
|
### Ubuntu
|
||||||
|
```
|
||||||
|
sudo add-apt-repository ppa:suwayomi/tachidesk-server
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install tachidesk
|
sudo apt install tachidesk-server
|
||||||
```
|
```
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|||||||
+16
-80
@@ -1,12 +1,14 @@
|
|||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
|
||||||
import org.jmailen.gradle.kotlinter.tasks.FormatTask
|
import org.jmailen.gradle.kotlinter.tasks.FormatTask
|
||||||
import org.jmailen.gradle.kotlinter.tasks.LintTask
|
import org.jmailen.gradle.kotlinter.tasks.LintTask
|
||||||
|
|
||||||
|
@Suppress("DSL_SCOPE_VIOLATION")
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version kotlinVersion
|
alias(libs.plugins.kotlin.jvm)
|
||||||
kotlin("plugin.serialization") version kotlinVersion
|
alias(libs.plugins.kotlin.serialization)
|
||||||
id("org.jmailen.kotlinter") version "3.6.0"
|
alias(libs.plugins.kotlinter)
|
||||||
id("com.github.gmazzo.buildconfig") version "3.0.3" apply false
|
alias(libs.plugins.buildconfig) apply false
|
||||||
|
alias(libs.plugins.download)
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
@@ -17,38 +19,24 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
maven("https://jitpack.io")
|
|
||||||
maven("https://github.com/Suwayomi/Tachidesk-Server/raw/android-jar/")
|
maven("https://github.com/Suwayomi/Tachidesk-Server/raw/android-jar/")
|
||||||
|
maven("https://jitpack.io")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val projects = listOf(
|
subprojects {
|
||||||
project(":AndroidCompat"),
|
plugins.withType<JavaPlugin> {
|
||||||
project(":AndroidCompat:Config"),
|
extensions.configure<JavaPluginExtension> {
|
||||||
project(":server")
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
)
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
configure(projects) {
|
|
||||||
apply(plugin = "org.jetbrains.kotlin.jvm")
|
|
||||||
apply(plugin = "org.jetbrains.kotlin.plugin.serialization")
|
|
||||||
apply(plugin = "org.jmailen.kotlinter")
|
|
||||||
|
|
||||||
java {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
withType<KotlinCompile> {
|
withType<KotlinJvmCompile> {
|
||||||
dependsOn(formatKotlin)
|
dependsOn("formatKotlin")
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
||||||
freeCompilerArgs = listOf(
|
|
||||||
"-Xopt-in=kotlin.RequiresOptIn",
|
|
||||||
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
|
||||||
"-Xopt-in=kotlinx.coroutines.InternalCoroutinesApi",
|
|
||||||
"-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,56 +48,4 @@ configure(projects) {
|
|||||||
source(files("src/kotlin"))
|
source(files("src/kotlin"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
// Kotlin
|
|
||||||
implementation(kotlin("stdlib-jdk8"))
|
|
||||||
implementation(kotlin("reflect"))
|
|
||||||
testImplementation(kotlin("test-junit5"))
|
|
||||||
|
|
||||||
// coroutines
|
|
||||||
val coroutinesVersion = "1.5.2"
|
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
|
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutinesVersion")
|
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion")
|
|
||||||
|
|
||||||
val kotlinSerializationVersion = "1.3.0-RC"
|
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinSerializationVersion")
|
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$kotlinSerializationVersion")
|
|
||||||
|
|
||||||
// Dependency Injection
|
|
||||||
implementation("org.kodein.di:kodein-di-conf-jvm:7.8.0")
|
|
||||||
|
|
||||||
// Logging
|
|
||||||
implementation("org.slf4j:slf4j-api:1.7.32")
|
|
||||||
implementation("ch.qos.logback:logback-classic:1.2.6")
|
|
||||||
implementation("io.github.microutils:kotlin-logging:2.0.11")
|
|
||||||
|
|
||||||
// ReactiveX
|
|
||||||
implementation("io.reactivex:rxjava:1.3.8")
|
|
||||||
implementation("io.reactivex:rxkotlin:1.0.0")
|
|
||||||
implementation("com.jakewharton.rxrelay:rxrelay:1.2.0")
|
|
||||||
|
|
||||||
// dependency both in AndroidCompat and extensions, version locked by Tachiyomi app/extensions
|
|
||||||
implementation("org.jsoup:jsoup:1.14.2")
|
|
||||||
|
|
||||||
// dependency of :AndroidCompat:Config
|
|
||||||
implementation("com.typesafe:config:1.4.1")
|
|
||||||
implementation("io.github.config4k:config4k:0.4.2")
|
|
||||||
|
|
||||||
// to get application content root
|
|
||||||
implementation("net.harawata:appdirs:1.2.1")
|
|
||||||
|
|
||||||
// dex2jar
|
|
||||||
val dex2jarVersion = "v26"
|
|
||||||
implementation("com.github.ThexXTURBOXx.dex2jar:dex-translator:$dex2jarVersion")
|
|
||||||
implementation("com.github.ThexXTURBOXx.dex2jar:dex-tools:$dex2jarVersion")
|
|
||||||
|
|
||||||
// APK parser
|
|
||||||
implementation("net.dongliu:apk-parser:2.6.10")
|
|
||||||
|
|
||||||
// dependency both in AndroidCompat and server, version locked by javalin
|
|
||||||
implementation("com.fasterxml.jackson.core:jackson-annotations:2.12.4")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -7,20 +7,18 @@ import java.io.BufferedReader
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
const val kotlinVersion = "1.5.30"
|
|
||||||
|
|
||||||
const val MainClass = "suwayomi.tachidesk.MainKt"
|
const val MainClass = "suwayomi.tachidesk.MainKt"
|
||||||
|
|
||||||
// should be bumped with each stable release
|
// should be bumped with each stable release
|
||||||
val tachideskVersion = System.getenv("ProductVersion") ?: "v0.6.0"
|
val tachideskVersion = System.getenv("ProductVersion") ?: "v0.7.0"
|
||||||
|
|
||||||
val webUIRevisionTag = System.getenv("WebUIRevision") ?: "r893"
|
val webUIRevisionTag = System.getenv("WebUIRevision") ?: "r983"
|
||||||
|
|
||||||
// counts commits on the master branch
|
// counts commits on the master branch
|
||||||
val tachideskRevision = runCatching {
|
val tachideskRevision = runCatching {
|
||||||
System.getenv("ProductRevision") ?: Runtime
|
System.getenv("ProductRevision") ?: ProcessBuilder()
|
||||||
.getRuntime()
|
.command("git", "rev-list", "HEAD", "--count")
|
||||||
.exec("git rev-list HEAD --count")
|
.start()
|
||||||
.let { process ->
|
.let { process ->
|
||||||
process.waitFor()
|
process.waitFor()
|
||||||
val output = process.inputStream.use {
|
val output = process.inputStream.use {
|
||||||
|
|||||||
@@ -0,0 +1,216 @@
|
|||||||
|
[versions]
|
||||||
|
kotlin = "1.8.0"
|
||||||
|
coroutines = "1.6.4"
|
||||||
|
serialization = "1.4.1"
|
||||||
|
okhttp = "5.0.0-alpha.11" # Major version is locked by Tachiyomi extensions
|
||||||
|
javalin = "4.6.6" # Javalin 5.0.0+ requires Java 11
|
||||||
|
jackson = "2.13.3" # jackson version locked by javalin, ref: `io.javalin.core.util.OptionalDependency`
|
||||||
|
exposed = "0.40.1"
|
||||||
|
dex2jar = "v59"
|
||||||
|
rhino = "1.7.14"
|
||||||
|
settings = "1.0.0-RC"
|
||||||
|
twelvemonkeys = "3.9.4"
|
||||||
|
playwright = "1.28.0"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
# Kotlin
|
||||||
|
kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
|
||||||
|
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
|
||||||
|
kotlin-test-junit5 = { module = "org.jetbrains.kotlin:kotlin-test-junit5", version.ref = "kotlin" }
|
||||||
|
|
||||||
|
# Coroutines
|
||||||
|
coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
|
||||||
|
coroutines-jdk8 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8", version.ref = "coroutines" }
|
||||||
|
coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }
|
||||||
|
|
||||||
|
# Serialization
|
||||||
|
serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" }
|
||||||
|
serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "serialization" }
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
slf4japi = "org.slf4j:slf4j-api:2.0.6"
|
||||||
|
logback = "ch.qos.logback:logback-classic:1.3.5"
|
||||||
|
kotlinlogging = "io.github.microutils:kotlin-logging:3.0.5"
|
||||||
|
|
||||||
|
# OkHttp
|
||||||
|
okhttp-core = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
|
||||||
|
okhttp-logging = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" }
|
||||||
|
okhttp-dnsoverhttps = { module = "com.squareup.okhttp3:okhttp-dnsoverhttps", version.ref = "okhttp" }
|
||||||
|
okio = "com.squareup.okio:okio:3.3.0"
|
||||||
|
|
||||||
|
# Javalin api
|
||||||
|
javalin-core = { module = "io.javalin:javalin", version.ref = "javalin" }
|
||||||
|
javalin-openapi = { module = "io.javalin:javalin-openapi", version.ref = "javalin" }
|
||||||
|
jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson" }
|
||||||
|
jackson-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "jackson" }
|
||||||
|
jackson-annotations = { module = "com.fasterxml.jackson.core:jackson-annotations", version.ref = "jackson" }
|
||||||
|
|
||||||
|
# Exposed ORM
|
||||||
|
exposed-core = { module = "org.jetbrains.exposed:exposed-core", version.ref = "exposed" }
|
||||||
|
exposed-dao = { module = "org.jetbrains.exposed:exposed-dao", version.ref = "exposed" }
|
||||||
|
exposed-jdbc = { module = "org.jetbrains.exposed:exposed-jdbc", version.ref = "exposed" }
|
||||||
|
exposed-javatime = { module = "org.jetbrains.exposed:exposed-java-time", version.ref = "exposed" }
|
||||||
|
h2 = "com.h2database:h2:1.4.200" # current database driver, can't update to h2 v2 without sql migration
|
||||||
|
|
||||||
|
# Exposed Migrations
|
||||||
|
exposed-migrations = "com.github.Suwayomi:exposed-migrations:3.2.0"
|
||||||
|
|
||||||
|
# Dependency Injection
|
||||||
|
kodein = "org.kodein.di:kodein-di-conf-jvm:7.15.0"
|
||||||
|
|
||||||
|
# tray icon
|
||||||
|
systemtray-core = "com.dorkbox:SystemTray:4.2.1"
|
||||||
|
systemtray-utils = "com.dorkbox:Utilities:1.39" # version locked by SystemTray
|
||||||
|
systemtray-desktop = "com.dorkbox:Desktop:1.0"
|
||||||
|
|
||||||
|
# dependencies of Tachiyomi extensions
|
||||||
|
injekt = "com.github.inorichi.injekt:injekt-core:65b0440"
|
||||||
|
rxjava = "io.reactivex:rxjava:1.3.8"
|
||||||
|
jsoup = "org.jsoup:jsoup:1.15.3"
|
||||||
|
|
||||||
|
# Config
|
||||||
|
config = "com.typesafe:config:1.4.2"
|
||||||
|
config4k = "io.github.config4k:config4k:0.5.0"
|
||||||
|
|
||||||
|
# Sort
|
||||||
|
sort = "com.github.gpanther:java-nat-sort:natural-comparator-1.1"
|
||||||
|
|
||||||
|
# Android stub library
|
||||||
|
android-stubs = "com.github.Suwayomi:android-jar:1.0.0"
|
||||||
|
|
||||||
|
# Asm modificiation
|
||||||
|
asm = "org.ow2.asm:asm:9.4" # version locked by Dex2Jar
|
||||||
|
dex2jar-translator = { module = "com.github.ThexXTURBOXx.dex2jar:dex-translator", version.ref = "dex2jar" }
|
||||||
|
dex2jar-tools = { module = "com.github.ThexXTURBOXx.dex2jar:dex-tools", version.ref = "dex2jar" }
|
||||||
|
|
||||||
|
# APK
|
||||||
|
apk-parser = "net.dongliu:apk-parser:2.6.10"
|
||||||
|
apksig = "com.android.tools.build:apksig:7.2.1"
|
||||||
|
|
||||||
|
# Xml
|
||||||
|
xmlpull = "xmlpull:xmlpull:1.1.3.4a"
|
||||||
|
|
||||||
|
# Disk & File
|
||||||
|
appdirs = "net.harawata:appdirs:1.2.1"
|
||||||
|
zip4j = "net.lingala.zip4j:zip4j:2.11.2"
|
||||||
|
junrar = "com.github.junrar:junrar:7.5.3"
|
||||||
|
|
||||||
|
# CloudflareInterceptor
|
||||||
|
playwright = { module = "com.microsoft.playwright:playwright", version.ref = "playwright" }
|
||||||
|
|
||||||
|
# AES/CBC/PKCS7Padding Cypher provider
|
||||||
|
bouncycastle = "org.bouncycastle:bcprov-jdk18on:1.72"
|
||||||
|
|
||||||
|
# AndroidX annotations
|
||||||
|
android-annotations = "androidx.annotation:annotation:1.5.0"
|
||||||
|
|
||||||
|
# Substitute for duktape-android
|
||||||
|
rhino-runtime = { module = "org.mozilla:rhino-runtime", version.ref = "rhino" } # slimmer version of 'org.mozilla:rhino'
|
||||||
|
rhino-engine = { module = "org.mozilla:rhino-engine", version.ref = "rhino" } # provides the same interface as 'javax.script' a.k.a Nashorn
|
||||||
|
|
||||||
|
# Settings
|
||||||
|
settings-core = { module = "com.russhwolf:multiplatform-settings-jvm", version.ref = "settings" }
|
||||||
|
settings-serialization = { module = "com.russhwolf:multiplatform-settings-serialization-jvm", version.ref = "settings" }
|
||||||
|
|
||||||
|
# ICU4J
|
||||||
|
icu4j = "com.ibm.icu:icu4j:72.1"
|
||||||
|
|
||||||
|
# Image Decoding implementation provider
|
||||||
|
twelvemonkeys-common-lang = { module = "com.twelvemonkeys.common:common-lang", version.ref = "twelvemonkeys" }
|
||||||
|
twelvemonkeys-common-io = { module = "com.twelvemonkeys.common:common-io", version.ref = "twelvemonkeys" }
|
||||||
|
twelvemonkeys-common-image = { module = "com.twelvemonkeys.common:common-image", version.ref = "twelvemonkeys" }
|
||||||
|
twelvemonkeys-imageio-core = { module = "com.twelvemonkeys.imageio:imageio-core", version.ref = "twelvemonkeys" }
|
||||||
|
twelvemonkeys-imageio-metadata = { module = "com.twelvemonkeys.imageio:imageio-metadata", version.ref = "twelvemonkeys" }
|
||||||
|
twelvemonkeys-imageio-jpeg = { module = "com.twelvemonkeys.imageio:imageio-jpeg", version.ref = "twelvemonkeys" }
|
||||||
|
twelvemonkeys-imageio-webp = { module = "com.twelvemonkeys.imageio:imageio-webp", version.ref = "twelvemonkeys" }
|
||||||
|
|
||||||
|
# Testing
|
||||||
|
mockk = "io.mockk:mockk:1.13.2"
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
# Kotlin
|
||||||
|
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin"}
|
||||||
|
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin"}
|
||||||
|
|
||||||
|
# Linter
|
||||||
|
kotlinter = { id = "org.jmailen.kotlinter", version = "3.12.0"}
|
||||||
|
|
||||||
|
# Build config
|
||||||
|
buildconfig = { id = "com.github.gmazzo.buildconfig", version = "3.1.0"}
|
||||||
|
|
||||||
|
# Download
|
||||||
|
download = { id = "de.undercouch.download", version = "5.3.0"}
|
||||||
|
|
||||||
|
# ShadowJar
|
||||||
|
shadowjar = { id = "com.github.johnrengelman.shadow", version = "7.1.2"}
|
||||||
|
|
||||||
|
[bundles]
|
||||||
|
shared = [
|
||||||
|
"kotlin-stdlib-jdk8",
|
||||||
|
"kotlin-reflect",
|
||||||
|
"coroutines-core",
|
||||||
|
"coroutines-jdk8",
|
||||||
|
"serialization-json",
|
||||||
|
"serialization-protobuf",
|
||||||
|
"kodein",
|
||||||
|
"slf4japi",
|
||||||
|
"logback",
|
||||||
|
"kotlinlogging",
|
||||||
|
"appdirs",
|
||||||
|
"rxjava",
|
||||||
|
"jsoup",
|
||||||
|
"config",
|
||||||
|
"config4k",
|
||||||
|
"dex2jar-translator",
|
||||||
|
"dex2jar-tools",
|
||||||
|
"apk-parser",
|
||||||
|
"jackson-annotations"
|
||||||
|
]
|
||||||
|
|
||||||
|
sharedTest = [
|
||||||
|
"kotlin-test-junit5",
|
||||||
|
"coroutines-test",
|
||||||
|
]
|
||||||
|
|
||||||
|
okhttp = [
|
||||||
|
"okhttp-core",
|
||||||
|
"okhttp-logging",
|
||||||
|
"okhttp-dnsoverhttps",
|
||||||
|
]
|
||||||
|
javalin = [
|
||||||
|
"javalin-core",
|
||||||
|
"javalin-openapi",
|
||||||
|
]
|
||||||
|
jackson = [
|
||||||
|
"jackson-databind",
|
||||||
|
"jackson-kotlin",
|
||||||
|
"jackson-annotations",
|
||||||
|
]
|
||||||
|
exposed = [
|
||||||
|
"exposed-core",
|
||||||
|
"exposed-dao",
|
||||||
|
"exposed-jdbc",
|
||||||
|
"exposed-javatime",
|
||||||
|
]
|
||||||
|
systemtray = [
|
||||||
|
"systemtray-core",
|
||||||
|
"systemtray-utils",
|
||||||
|
"systemtray-desktop"
|
||||||
|
]
|
||||||
|
rhino = [
|
||||||
|
"rhino-runtime",
|
||||||
|
"rhino-engine",
|
||||||
|
]
|
||||||
|
settings = [
|
||||||
|
"settings-core",
|
||||||
|
"settings-serialization",
|
||||||
|
]
|
||||||
|
twelvemonkeys = [
|
||||||
|
"twelvemonkeys-common-lang",
|
||||||
|
"twelvemonkeys-common-io",
|
||||||
|
"twelvemonkeys-common-image",
|
||||||
|
"twelvemonkeys-imageio-core",
|
||||||
|
"twelvemonkeys-imageio-metadata",
|
||||||
|
"twelvemonkeys-imageio-jpeg",
|
||||||
|
"twelvemonkeys-imageio-webp",
|
||||||
|
]
|
||||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright 2015 the original author or authors.
|
# Copyright © 2015-2021 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -17,67 +17,101 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## Gradle start up script for UN*X
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
##
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
APP_NAME="Gradle"
|
||||||
APP_BASE_NAME=`basename "$0"`
|
APP_BASE_NAME=${0##*/}
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD=maximum
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
@@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
@@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
|||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD="java"
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
@@ -106,80 +140,101 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
warn "Could not query maximum file descriptor limit"
|
||||||
fi
|
esac
|
||||||
ulimit -n $MAX_FD
|
case $MAX_FD in #(
|
||||||
if [ $? -ne 0 ] ; then
|
'' | soft) :;; #(
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
*)
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
else
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=`expr $i + 1`
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
0) set -- ;;
|
|
||||||
1) set -- "$args0" ;;
|
|
||||||
2) set -- "$args0" "$args1" ;;
|
|
||||||
3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=`save "$@"`
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|||||||
Vendored
+8
-6
@@ -14,7 +14,7 @@
|
|||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
@@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|||||||
Executable
+318
@@ -0,0 +1,318 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright (C) Contributors to the Suwayomi project
|
||||||
|
#
|
||||||
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
main() {
|
||||||
|
POSITIONAL_ARGS=()
|
||||||
|
OUTPUT_DIR=.
|
||||||
|
while [ "$#" -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
-o|--output-dir)
|
||||||
|
OUTPUT_DIR="$(readlink -e "$2" || exit 1)"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
POSITIONAL_ARGS+=("$1")
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
# restore positional parameters
|
||||||
|
set -- "${POSITIONAL_ARGS[@]}"
|
||||||
|
|
||||||
|
OS="$1"
|
||||||
|
PLAYWRIGHT_VERSION="$(cat gradle/libs.versions.toml | grep -oP "playwright = \"\K([0-9\.]*)(?=\")")"
|
||||||
|
PLAYWRIGHT_REVISION="$(curl --silent "https://raw.githubusercontent.com/microsoft/playwright/v$PLAYWRIGHT_VERSION/packages/playwright-core/browsers.json" 2>&1 | grep -ozP "\"name\": \"chromium\",\n *\"revision\": \"\K[0-9]*")"
|
||||||
|
JAR="$(ls server/build/*.jar | tail -n1)"
|
||||||
|
RELEASE_NAME="$(echo "${JAR%.*}" | xargs basename)-$OS"
|
||||||
|
RELEASE_VERSION="$(tmp="${JAR%-*}"; echo "${tmp##*-}" | tr -d v)"
|
||||||
|
#RELEASE_REVISION_NUMBER="$(tmp="${JAR%.*}" && echo "${tmp##*-}" | tr -d r)"
|
||||||
|
local electron_version="v14.0.0"
|
||||||
|
|
||||||
|
# clean temporary directory on function return
|
||||||
|
trap "rm -rf $RELEASE_NAME/" RETURN
|
||||||
|
mkdir "$RELEASE_NAME/"
|
||||||
|
|
||||||
|
case "$OS" in
|
||||||
|
debian-all)
|
||||||
|
RELEASE="$RELEASE_NAME.deb"
|
||||||
|
make_deb_package
|
||||||
|
move_release_to_output_dir
|
||||||
|
;;
|
||||||
|
linux-assets)
|
||||||
|
RELEASE="$RELEASE_NAME.tar.gz"
|
||||||
|
copy_linux_package_assets_to "$RELEASE_NAME/"
|
||||||
|
tar -I "gzip -9" -cvf "$RELEASE" "$RELEASE_NAME/"
|
||||||
|
move_release_to_output_dir
|
||||||
|
;;
|
||||||
|
linux-x64)
|
||||||
|
JRE="OpenJDK8U-jre_x64_linux_hotspot_8u302b08.tar.gz"
|
||||||
|
JRE_RELEASE="jdk8u302-b08"
|
||||||
|
JRE_DIR="$JRE_RELEASE-jre"
|
||||||
|
JRE_URL="https://github.com/adoptium/temurin8-binaries/releases/download/$JRE_RELEASE/$JRE"
|
||||||
|
ELECTRON="electron-$electron_version-linux-x64.zip"
|
||||||
|
ELECTRON_URL="https://github.com/electron/electron/releases/download/$electron_version/$ELECTRON"
|
||||||
|
download_jre_and_electron
|
||||||
|
|
||||||
|
PLAYWRIGHT_PLATFORM="linux"
|
||||||
|
setup_playwright
|
||||||
|
|
||||||
|
RELEASE="$RELEASE_NAME.tar.gz"
|
||||||
|
make_linux_bundle
|
||||||
|
move_release_to_output_dir
|
||||||
|
;;
|
||||||
|
macOS-x64)
|
||||||
|
JRE="OpenJDK8U-jre_x64_mac_hotspot_8u302b08.tar.gz"
|
||||||
|
JRE_RELEASE="jdk8u302-b08"
|
||||||
|
JRE_DIR="$JRE_RELEASE-jre"
|
||||||
|
JRE_URL="https://github.com/adoptium/temurin8-binaries/releases/download/$JRE_RELEASE/$JRE"
|
||||||
|
ELECTRON="electron-$electron_version-darwin-x64.zip"
|
||||||
|
ELECTRON_URL="https://github.com/electron/electron/releases/download/$electron_version/$ELECTRON"
|
||||||
|
download_jre_and_electron
|
||||||
|
|
||||||
|
PLAYWRIGHT_PLATFORM="mac"
|
||||||
|
setup_playwright
|
||||||
|
|
||||||
|
RELEASE="$RELEASE_NAME.zip"
|
||||||
|
make_macos_bundle
|
||||||
|
move_release_to_output_dir
|
||||||
|
;;
|
||||||
|
macOS-arm64)
|
||||||
|
JRE="zulu8.56.0.23-ca-jre8.0.302-macosx_aarch64.tar.gz"
|
||||||
|
JRE_RELEASE="zulu8.56.0.23-ca-jre8.0.302-macosx_aarch64"
|
||||||
|
JRE_DIR="$JRE_RELEASE/zulu-8.jre"
|
||||||
|
JRE_URL="https://cdn.azul.com/zulu/bin/$JRE"
|
||||||
|
ELECTRON="electron-$electron_version-darwin-arm64.zip"
|
||||||
|
ELECTRON_URL="https://github.com/electron/electron/releases/download/$electron_version/$ELECTRON"
|
||||||
|
download_jre_and_electron
|
||||||
|
|
||||||
|
PLAYWRIGHT_PLATFORM="mac-arm64"
|
||||||
|
setup_playwright
|
||||||
|
|
||||||
|
RELEASE="$RELEASE_NAME.zip"
|
||||||
|
make_macos_bundle
|
||||||
|
move_release_to_output_dir
|
||||||
|
;;
|
||||||
|
windows-x86)
|
||||||
|
JRE="OpenJDK8U-jre_x86-32_windows_hotspot_8u292b10.zip"
|
||||||
|
JRE_RELEASE="jdk8u292-b10"
|
||||||
|
JRE_DIR="$JRE_RELEASE-jre"
|
||||||
|
JRE_URL="https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/$JRE_RELEASE/$JRE"
|
||||||
|
ELECTRON="electron-$electron_version-win32-ia32.zip"
|
||||||
|
ELECTRON_URL="https://github.com/electron/electron/releases/download/$electron_version/$ELECTRON"
|
||||||
|
download_jre_and_electron
|
||||||
|
|
||||||
|
PLAYWRIGHT_PLATFORM="win64"
|
||||||
|
setup_playwright
|
||||||
|
|
||||||
|
RELEASE="$RELEASE_NAME.zip"
|
||||||
|
make_windows_bundle
|
||||||
|
move_release_to_output_dir
|
||||||
|
|
||||||
|
RELEASE="$RELEASE_NAME.msi"
|
||||||
|
make_windows_package
|
||||||
|
move_release_to_output_dir
|
||||||
|
;;
|
||||||
|
windows-x64)
|
||||||
|
JRE="OpenJDK8U-jre_x64_windows_hotspot_8u302b08.zip"
|
||||||
|
JRE_RELEASE="jdk8u302-b08"
|
||||||
|
JRE_DIR="$JRE_RELEASE-jre"
|
||||||
|
JRE_URL="https://github.com/adoptium/temurin8-binaries/releases/download/$JRE_RELEASE/$JRE"
|
||||||
|
ELECTRON="electron-$electron_version-win32-x64.zip"
|
||||||
|
ELECTRON_URL="https://github.com/electron/electron/releases/download/$electron_version/$ELECTRON"
|
||||||
|
download_jre_and_electron
|
||||||
|
|
||||||
|
PLAYWRIGHT_PLATFORM="win64"
|
||||||
|
setup_playwright
|
||||||
|
|
||||||
|
RELEASE="$RELEASE_NAME.zip"
|
||||||
|
make_windows_bundle
|
||||||
|
move_release_to_output_dir
|
||||||
|
|
||||||
|
RELEASE="$RELEASE_NAME.msi"
|
||||||
|
make_windows_package
|
||||||
|
move_release_to_output_dir
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error $LINENO "Unsupported operating system: $OS" 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
move_release_to_output_dir() {
|
||||||
|
# clean up from possible previous runs
|
||||||
|
if [ -f "$OUTPUT_DIR/$RELEASE" ]; then
|
||||||
|
rm "$OUTPUT_DIR/$RELEASE"
|
||||||
|
fi
|
||||||
|
mv "$RELEASE" "$OUTPUT_DIR/"
|
||||||
|
}
|
||||||
|
|
||||||
|
download_jre_and_electron() {
|
||||||
|
if [ ! -f "$JRE" ]; then
|
||||||
|
curl -L "$JRE_URL" -o "$JRE"
|
||||||
|
fi
|
||||||
|
if [ ! -f "$ELECTRON" ]; then
|
||||||
|
curl -L "$ELECTRON_URL" -o "$ELECTRON"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local ext="${JRE##*.}"
|
||||||
|
if [ "$ext" = "zip" ]; then
|
||||||
|
unzip "$JRE"
|
||||||
|
else
|
||||||
|
tar xvf "$JRE"
|
||||||
|
fi
|
||||||
|
mv "$JRE_DIR" "$RELEASE_NAME/jre"
|
||||||
|
unzip "$ELECTRON" -d "$RELEASE_NAME/electron/"
|
||||||
|
tree
|
||||||
|
}
|
||||||
|
|
||||||
|
copy_linux_package_assets_to() {
|
||||||
|
local output_dir
|
||||||
|
output_dir="$(readlink -e "$1" || exit 1)"
|
||||||
|
|
||||||
|
cp "scripts/resources/pkg/tachidesk-server-browser-launcher.sh" "$output_dir/"
|
||||||
|
cp "scripts/resources/pkg/tachidesk-server-debug-launcher.sh" "$output_dir/"
|
||||||
|
cp "scripts/resources/pkg/tachidesk-server-electron-launcher.sh" "$output_dir/"
|
||||||
|
cp "scripts/resources/pkg/tachidesk-server.desktop" "$output_dir/"
|
||||||
|
cp "scripts/resources/pkg/systemd"/* "$output_dir/"
|
||||||
|
cp "server/src/main/resources/icon/faviconlogo.png" \
|
||||||
|
"$output_dir/tachidesk-server.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
make_linux_bundle() {
|
||||||
|
cp "$JAR" "$RELEASE_NAME/Tachidesk-Server.jar"
|
||||||
|
cp "scripts/resources/tachidesk-server-browser-launcher.sh" "$RELEASE_NAME/"
|
||||||
|
cp "scripts/resources/tachidesk-server-debug-launcher.sh" "$RELEASE_NAME/"
|
||||||
|
cp "scripts/resources/tachidesk-server-electron-launcher.sh" "$RELEASE_NAME/"
|
||||||
|
|
||||||
|
tar -I "gzip -9" -cvf "$RELEASE" "$RELEASE_NAME/"
|
||||||
|
}
|
||||||
|
|
||||||
|
make_macos_bundle() {
|
||||||
|
cp "$JAR" "$RELEASE_NAME/Tachidesk-Server.jar"
|
||||||
|
cp "scripts/resources/Tachidesk Browser Launcher.command" "$RELEASE_NAME/"
|
||||||
|
cp "scripts/resources/Tachidesk Debug Launcher.command" "$RELEASE_NAME/"
|
||||||
|
cp "scripts/resources/Tachidesk Electron Launcher.command" "$RELEASE_NAME/"
|
||||||
|
|
||||||
|
zip -9 -r "$RELEASE" "$RELEASE_NAME/"
|
||||||
|
}
|
||||||
|
|
||||||
|
# https://wiki.debian.org/SimplePackagingTutorial
|
||||||
|
# https://www.debian.org/doc/manuals/packaging-tutorial/packaging-tutorial.pdf
|
||||||
|
make_deb_package() {
|
||||||
|
#behind $RELEASE_VERSION is hyphen "-"
|
||||||
|
local source_dir="tachidesk-server-$RELEASE_VERSION"
|
||||||
|
#behind $RELEASE_VERSION is underscore "_"
|
||||||
|
local upstream_source="tachidesk-server_$RELEASE_VERSION.orig.tar.gz"
|
||||||
|
|
||||||
|
mkdir "$RELEASE_NAME/$source_dir/"
|
||||||
|
cp "$JAR" "$RELEASE_NAME/$source_dir/Tachidesk-Server.jar"
|
||||||
|
copy_linux_package_assets_to "$RELEASE_NAME/$source_dir/"
|
||||||
|
tar -I "gzip" -C "$RELEASE_NAME/" -cvf "$upstream_source" "$source_dir"
|
||||||
|
|
||||||
|
cp -r "scripts/resources/deb/" "$RELEASE_NAME/$source_dir/debian/"
|
||||||
|
sed -i "s/\$pkgver/$RELEASE_VERSION/" "$RELEASE_NAME/$source_dir/debian/changelog"
|
||||||
|
sed -i "s/\$pkgrel/1/" "$RELEASE_NAME/$source_dir/debian/changelog"
|
||||||
|
|
||||||
|
sudo apt install devscripts build-essential dh-exec
|
||||||
|
cd "$RELEASE_NAME/$source_dir/"
|
||||||
|
dpkg-buildpackage --no-sign --build=all
|
||||||
|
cd -
|
||||||
|
|
||||||
|
local deb="tachidesk-server_$RELEASE_VERSION-1_all.deb"
|
||||||
|
mv "$RELEASE_NAME/$deb" "$RELEASE"
|
||||||
|
}
|
||||||
|
|
||||||
|
make_windows_bundle() {
|
||||||
|
## I disabled this section until someone find a solution to this error:
|
||||||
|
##E: Unable to correct problems, you have held broken packages.
|
||||||
|
##./bundler.sh: line 250: wine: command not found
|
||||||
|
|
||||||
|
## check if running under github actions
|
||||||
|
#if [ "$CI" = true ]; then
|
||||||
|
## change electron executable's icon
|
||||||
|
#sudo dpkg --add-architecture i386
|
||||||
|
#wget -qO - https://dl.winehq.org/wine-builds/winehq.key \
|
||||||
|
#| sudo apt-key add -
|
||||||
|
#sudo add-apt-repository ppa:cybermax-dexter/sdl2-backport
|
||||||
|
#sudo apt-add-repository "deb https://dl.winehq.org/wine-builds/ubuntu \
|
||||||
|
#$(lsb_release -cs) main"
|
||||||
|
#sudo apt install --install-recommends winehq-stable
|
||||||
|
#fi
|
||||||
|
## this script assumes that wine is installed here on out
|
||||||
|
|
||||||
|
#local rcedit="rcedit-x85.exe"
|
||||||
|
#local rcedit_url="https://github.com/electron/rcedit/releases/download/v0.1.1/$rcedit"
|
||||||
|
## change electron's icon
|
||||||
|
#if [ ! -f "$rcedit" ]; then
|
||||||
|
#curl -L "$rcedit_url" -o "$rcedit"
|
||||||
|
#fi
|
||||||
|
|
||||||
|
#local icon="server/src/main/resources/icon/faviconlogo.ico"
|
||||||
|
#WINEARCH=win32 wine "$rcedit" "$RELEASE_NAME/electron/electron.exe" \
|
||||||
|
# --set-icon "$icon"
|
||||||
|
|
||||||
|
cp "$JAR" "$RELEASE_NAME/Tachidesk-Server.jar"
|
||||||
|
cp "scripts/resources/Tachidesk Browser Launcher.bat" "$RELEASE_NAME"
|
||||||
|
cp "scripts/resources/Tachidesk Debug Launcher.bat" "$RELEASE_NAME"
|
||||||
|
cp "scripts/resources/Tachidesk Electron Launcher.bat" "$RELEASE_NAME"
|
||||||
|
|
||||||
|
zip -9 -r "$RELEASE" "$RELEASE_NAME"
|
||||||
|
}
|
||||||
|
|
||||||
|
make_windows_package() {
|
||||||
|
if [ "$CI" = true ]; then
|
||||||
|
sudo apt install -y wixl
|
||||||
|
fi
|
||||||
|
|
||||||
|
find "$RELEASE_NAME/jre" \
|
||||||
|
| wixl-heat --var var.SourceDir -p "$RELEASE_NAME/" \
|
||||||
|
--directory-ref jre --component-group jre >"$RELEASE_NAME/jre.wxs"
|
||||||
|
find "$RELEASE_NAME/electron" \
|
||||||
|
| wixl-heat --var var.SourceDir -p "$RELEASE_NAME/" \
|
||||||
|
--directory-ref electron --component-group electron >"$RELEASE_NAME/electron.wxs"
|
||||||
|
|
||||||
|
local icon="server/src/main/resources/icon/faviconlogo.ico"
|
||||||
|
local arch=${OS##*-}
|
||||||
|
|
||||||
|
wixl -D ProductVersion="$RELEASE_VERSION" -D SourceDir="$RELEASE_NAME" \
|
||||||
|
-D Icon="$icon" --arch "$arch" "scripts/resources/msi/tachidesk-server-$arch.wxs" \
|
||||||
|
"$RELEASE_NAME/jre.wxs" "$RELEASE_NAME/electron.wxs" -o "$RELEASE"
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_playwright() {
|
||||||
|
mkdir "$RELEASE_NAME/bin"
|
||||||
|
curl -L "https://playwright.azureedge.net/builds/chromium/$PLAYWRIGHT_REVISION/chromium-$PLAYWRIGHT_PLATFORM.zip" -o "$RELEASE_NAME/bin/chromium.zip"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Error handler
|
||||||
|
# set -u: Treat unset variables as an error when substituting.
|
||||||
|
# set -o pipefail: Prevents errors in pipeline from being masked.
|
||||||
|
# set -e: Immediatly exit if any command has a non-zero exit status.
|
||||||
|
# set -E: Inherit the trap ERR function before exiting by set.
|
||||||
|
#
|
||||||
|
# set -e is not recommended and unpredictable.
|
||||||
|
# see https://stackoverflow.com/questions/64786/error-handling-in-bash
|
||||||
|
# and http://mywiki.wooledge.org/BashFAO/105
|
||||||
|
set -uo pipefail
|
||||||
|
error() {
|
||||||
|
local parent_lineno="$1"
|
||||||
|
local message="$2"
|
||||||
|
local code="${3:-1}"
|
||||||
|
if [ -z "$message" ]; then
|
||||||
|
echo "$0: line $parent_lineno: exiting with status $code"
|
||||||
|
else
|
||||||
|
echo "$0: line $parent_lineno: $message: exiting with status $code"
|
||||||
|
fi
|
||||||
|
exit "$code"
|
||||||
|
}
|
||||||
|
trap 'error $LINENO ""' ERR
|
||||||
|
|
||||||
|
main "$@"; exit
|
||||||
|
|
||||||
|
|
||||||
@@ -1 +1 @@
|
|||||||
start "" jre/bin/javaw -jar Tachidesk.jar
|
start "" jre/bin/javaw -jar Tachidesk-Server.jar
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
cd "`dirname "$0"`"
|
cd "`dirname "$0"`"
|
||||||
|
|
||||||
./jre/Contents/Home/bin/java -jar Tachidesk.jar
|
./jre/Contents/Home/bin/java -jar Tachidesk-Server.jar
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
:: cleaner output
|
:: cleaner output
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
jre\bin\java -Dsuwayomi.tachidesk.config.server.debugLogsEnabled=true -jar Tachidesk.jar
|
jre\bin\java -Dsuwayomi.tachidesk.config.server.debugLogsEnabled=true -jar Tachidesk-Server.jar
|
||||||
|
|
||||||
:: Prevent cmd from closing when Tachidesk crashes
|
:: Prevent cmd from closing when Tachidesk crashes
|
||||||
pause
|
pause
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
cd "`dirname "$0"`"
|
cd "`dirname "$0"`"
|
||||||
|
|
||||||
./jre/Contents/Home/bin/java -Dsuwayomi.tachidesk.config.server.debugLogsEnabled=true -jar Tachidesk.jar
|
./jre/Contents/Home/bin/java -Dsuwayomi.tachidesk.config.server.debugLogsEnabled=true -jar Tachidesk-Server.jar
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
jre\bin\javaw "-Dsuwayomi.tachidesk.config.server.webUIInterface=electron" "-Dsuwayomi.tachidesk.config.server.electronPath=electron/electron.exe" -jar Tachidesk.jar
|
jre\bin\javaw "-Dsuwayomi.tachidesk.config.server.webUIInterface=electron" "-Dsuwayomi.tachidesk.config.server.electronPath=electron/electron.exe" -jar Tachidesk-Server.jar
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
cd "`dirname "$0"`"
|
cd "`dirname "$0"`"
|
||||||
|
|
||||||
./jre/Contents/Home/bin/java "-Dsuwayomi.tachidesk.config.server.webUIInterface=electron" "-Dsuwayomi.tachidesk.config.server.electronPath=electron/Electron.app/Contents/MacOS/Electron" -jar Tachidesk.jar
|
./jre/Contents/Home/bin/java "-Dsuwayomi.tachidesk.config.server.webUIInterface=electron" "-Dsuwayomi.tachidesk.config.server.electronPath=electron/Electron.app/Contents/MacOS/Electron" -jar Tachidesk-Server.jar
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
tachidesk-server ($pkgver-$pkgrel) unstable; urgency=medium
|
||||||
|
|
||||||
|
* See CHANGELOG.md on https://github.com/Suwayomi/Tachidesk-Server
|
||||||
|
|
||||||
|
-- Mahor1221 <mahor1221@pm.me> Fri, 14 Jan 2022 00:00:00 +0000
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
Source: tachidesk-server
|
||||||
|
Section: web
|
||||||
|
Priority: optional
|
||||||
|
Maintainer: Mahor1221 <mahor1221@pm.me>
|
||||||
|
Build-Depends: debhelper-compat (= 13), dh-exec
|
||||||
|
Standards-Version: 4.5.1
|
||||||
|
Homepage: https://github.com/Suwayomi/Tachidesk-Server
|
||||||
|
|
||||||
|
Package: tachidesk-server
|
||||||
|
Architecture: all
|
||||||
|
Depends: ${misc:Depends}, java8-runtime-headless, libc++-dev
|
||||||
|
Description: Manga Reader
|
||||||
|
A free and open source manga reader server that runs extensions built for Tachiyomi.
|
||||||
|
Tachidesk is an independent Tachiyomi compatible software and is not a Fork of Tachiyomi.
|
||||||
@@ -0,0 +1,381 @@
|
|||||||
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
|
Upstream-Name: tachidesk-server
|
||||||
|
Upstream-Contact: https://discord.gg/DDZdqZWaHA
|
||||||
|
Source: https://github.com/Suwayomi/Tachidesk-Server
|
||||||
|
|
||||||
|
Files: *
|
||||||
|
Copyright: Contributors to the Suwayomi project
|
||||||
|
License: MPL-2.0
|
||||||
|
Mozilla Public License Version 2.0
|
||||||
|
==================================
|
||||||
|
.
|
||||||
|
1. Definitions
|
||||||
|
--------------
|
||||||
|
.
|
||||||
|
1.1. "Contributor"
|
||||||
|
means each individual or legal entity that creates, contributes to
|
||||||
|
the creation of, or owns Covered Software.
|
||||||
|
.
|
||||||
|
1.2. "Contributor Version"
|
||||||
|
means the combination of the Contributions of others (if any) used
|
||||||
|
by a Contributor and that particular Contributor's Contribution.
|
||||||
|
.
|
||||||
|
1.3. "Contribution"
|
||||||
|
means Covered Software of a particular Contributor.
|
||||||
|
.
|
||||||
|
1.4. "Covered Software"
|
||||||
|
means Source Code Form to which the initial Contributor has attached
|
||||||
|
the notice in Exhibit A, the Executable Form of such Source Code
|
||||||
|
Form, and Modifications of such Source Code Form, in each case
|
||||||
|
including portions thereof.
|
||||||
|
.
|
||||||
|
1.5. "Incompatible With Secondary Licenses"
|
||||||
|
means
|
||||||
|
.
|
||||||
|
(a) that the initial Contributor has attached the notice described
|
||||||
|
in Exhibit B to the Covered Software; or
|
||||||
|
.
|
||||||
|
(b) that the Covered Software was made available under the terms of
|
||||||
|
version 1.1 or earlier of the License, but not also under the
|
||||||
|
terms of a Secondary License.
|
||||||
|
.
|
||||||
|
1.6. "Executable Form"
|
||||||
|
means any form of the work other than Source Code Form.
|
||||||
|
.
|
||||||
|
1.7. "Larger Work"
|
||||||
|
means a work that combines Covered Software with other material, in
|
||||||
|
a separate file or files, that is not Covered Software.
|
||||||
|
.
|
||||||
|
1.8. "License"
|
||||||
|
means this document.
|
||||||
|
.
|
||||||
|
1.9. "Licensable"
|
||||||
|
means having the right to grant, to the maximum extent possible,
|
||||||
|
whether at the time of the initial grant or subsequently, any and
|
||||||
|
all of the rights conveyed by this License.
|
||||||
|
.
|
||||||
|
1.10. "Modifications"
|
||||||
|
means any of the following:
|
||||||
|
.
|
||||||
|
(a) any file in Source Code Form that results from an addition to,
|
||||||
|
deletion from, or modification of the contents of Covered
|
||||||
|
Software; or
|
||||||
|
.
|
||||||
|
(b) any new file in Source Code Form that contains any Covered
|
||||||
|
Software.
|
||||||
|
.
|
||||||
|
1.11. "Patent Claims" of a Contributor
|
||||||
|
means any patent claim(s), including without limitation, method,
|
||||||
|
process, and apparatus claims, in any patent Licensable by such
|
||||||
|
Contributor that would be infringed, but for the grant of the
|
||||||
|
License, by the making, using, selling, offering for sale, having
|
||||||
|
made, import, or transfer of either its Contributions or its
|
||||||
|
Contributor Version.
|
||||||
|
.
|
||||||
|
1.12. "Secondary License"
|
||||||
|
means either the GNU General Public License, Version 2.0, the GNU
|
||||||
|
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||||
|
Public License, Version 3.0, or any later versions of those
|
||||||
|
licenses.
|
||||||
|
.
|
||||||
|
1.13. "Source Code Form"
|
||||||
|
means the form of the work preferred for making modifications.
|
||||||
|
.
|
||||||
|
1.14. "You" (or "Your")
|
||||||
|
means an individual or a legal entity exercising rights under this
|
||||||
|
License. For legal entities, "You" includes any entity that
|
||||||
|
controls, is controlled by, or is under common control with You. For
|
||||||
|
purposes of this definition, "control" means (a) the power, direct
|
||||||
|
or indirect, to cause the direction or management of such entity,
|
||||||
|
whether by contract or otherwise, or (b) ownership of more than
|
||||||
|
fifty percent (50%) of the outstanding shares or beneficial
|
||||||
|
ownership of such entity.
|
||||||
|
.
|
||||||
|
2. License Grants and Conditions
|
||||||
|
--------------------------------
|
||||||
|
.
|
||||||
|
2.1. Grants
|
||||||
|
.
|
||||||
|
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||||
|
non-exclusive license:
|
||||||
|
.
|
||||||
|
(a) under intellectual property rights (other than patent or trademark)
|
||||||
|
Licensable by such Contributor to use, reproduce, make available,
|
||||||
|
modify, display, perform, distribute, and otherwise exploit its
|
||||||
|
Contributions, either on an unmodified basis, with Modifications, or
|
||||||
|
as part of a Larger Work; and
|
||||||
|
.
|
||||||
|
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||||
|
for sale, have made, import, and otherwise transfer either its
|
||||||
|
Contributions or its Contributor Version.
|
||||||
|
.
|
||||||
|
2.2. Effective Date
|
||||||
|
.
|
||||||
|
The licenses granted in Section 2.1 with respect to any Contribution
|
||||||
|
become effective for each Contribution on the date the Contributor first
|
||||||
|
distributes such Contribution.
|
||||||
|
.
|
||||||
|
2.3. Limitations on Grant Scope
|
||||||
|
.
|
||||||
|
The licenses granted in this Section 2 are the only rights granted under
|
||||||
|
this License. No additional rights or licenses will be implied from the
|
||||||
|
distribution or licensing of Covered Software under this License.
|
||||||
|
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||||
|
Contributor:
|
||||||
|
.
|
||||||
|
(a) for any code that a Contributor has removed from Covered Software;
|
||||||
|
or
|
||||||
|
.
|
||||||
|
(b) for infringements caused by: (i) Your and any other third party's
|
||||||
|
modifications of Covered Software, or (ii) the combination of its
|
||||||
|
Contributions with other software (except as part of its Contributor
|
||||||
|
Version); or
|
||||||
|
.
|
||||||
|
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||||
|
its Contributions.
|
||||||
|
.
|
||||||
|
This License does not grant any rights in the trademarks, service marks,
|
||||||
|
or logos of any Contributor (except as may be necessary to comply with
|
||||||
|
the notice requirements in Section 3.4).
|
||||||
|
.
|
||||||
|
2.4. Subsequent Licenses
|
||||||
|
.
|
||||||
|
No Contributor makes additional grants as a result of Your choice to
|
||||||
|
distribute the Covered Software under a subsequent version of this
|
||||||
|
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||||
|
permitted under the terms of Section 3.3).
|
||||||
|
.
|
||||||
|
2.5. Representation
|
||||||
|
.
|
||||||
|
Each Contributor represents that the Contributor believes its
|
||||||
|
Contributions are its original creation(s) or it has sufficient rights
|
||||||
|
to grant the rights to its Contributions conveyed by this License.
|
||||||
|
.
|
||||||
|
2.6. Fair Use
|
||||||
|
.
|
||||||
|
This License is not intended to limit any rights You have under
|
||||||
|
applicable copyright doctrines of fair use, fair dealing, or other
|
||||||
|
equivalents.
|
||||||
|
.
|
||||||
|
2.7. Conditions
|
||||||
|
.
|
||||||
|
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||||
|
in Section 2.1.
|
||||||
|
.
|
||||||
|
3. Responsibilities
|
||||||
|
-------------------
|
||||||
|
.
|
||||||
|
3.1. Distribution of Source Form
|
||||||
|
.
|
||||||
|
All distribution of Covered Software in Source Code Form, including any
|
||||||
|
Modifications that You create or to which You contribute, must be under
|
||||||
|
the terms of this License. You must inform recipients that the Source
|
||||||
|
Code Form of the Covered Software is governed by the terms of this
|
||||||
|
License, and how they can obtain a copy of this License. You may not
|
||||||
|
attempt to alter or restrict the recipients' rights in the Source Code
|
||||||
|
Form.
|
||||||
|
.
|
||||||
|
3.2. Distribution of Executable Form
|
||||||
|
.
|
||||||
|
If You distribute Covered Software in Executable Form then:
|
||||||
|
.
|
||||||
|
(a) such Covered Software must also be made available in Source Code
|
||||||
|
Form, as described in Section 3.1, and You must inform recipients of
|
||||||
|
the Executable Form how they can obtain a copy of such Source Code
|
||||||
|
Form by reasonable means in a timely manner, at a charge no more
|
||||||
|
than the cost of distribution to the recipient; and
|
||||||
|
.
|
||||||
|
(b) You may distribute such Executable Form under the terms of this
|
||||||
|
License, or sublicense it under different terms, provided that the
|
||||||
|
license for the Executable Form does not attempt to limit or alter
|
||||||
|
the recipients' rights in the Source Code Form under this License.
|
||||||
|
.
|
||||||
|
3.3. Distribution of a Larger Work
|
||||||
|
.
|
||||||
|
You may create and distribute a Larger Work under terms of Your choice,
|
||||||
|
provided that You also comply with the requirements of this License for
|
||||||
|
the Covered Software. If the Larger Work is a combination of Covered
|
||||||
|
Software with a work governed by one or more Secondary Licenses, and the
|
||||||
|
Covered Software is not Incompatible With Secondary Licenses, this
|
||||||
|
License permits You to additionally distribute such Covered Software
|
||||||
|
under the terms of such Secondary License(s), so that the recipient of
|
||||||
|
the Larger Work may, at their option, further distribute the Covered
|
||||||
|
Software under the terms of either this License or such Secondary
|
||||||
|
License(s).
|
||||||
|
.
|
||||||
|
3.4. Notices
|
||||||
|
.
|
||||||
|
You may not remove or alter the substance of any license notices
|
||||||
|
(including copyright notices, patent notices, disclaimers of warranty,
|
||||||
|
or limitations of liability) contained within the Source Code Form of
|
||||||
|
the Covered Software, except that You may alter any license notices to
|
||||||
|
the extent required to remedy known factual inaccuracies.
|
||||||
|
.
|
||||||
|
3.5. Application of Additional Terms
|
||||||
|
.
|
||||||
|
You may choose to offer, and to charge a fee for, warranty, support,
|
||||||
|
indemnity or liability obligations to one or more recipients of Covered
|
||||||
|
Software. However, You may do so only on Your own behalf, and not on
|
||||||
|
behalf of any Contributor. You must make it absolutely clear that any
|
||||||
|
such warranty, support, indemnity, or liability obligation is offered by
|
||||||
|
You alone, and You hereby agree to indemnify every Contributor for any
|
||||||
|
liability incurred by such Contributor as a result of warranty, support,
|
||||||
|
indemnity or liability terms You offer. You may include additional
|
||||||
|
disclaimers of warranty and limitations of liability specific to any
|
||||||
|
jurisdiction.
|
||||||
|
.
|
||||||
|
4. Inability to Comply Due to Statute or Regulation
|
||||||
|
---------------------------------------------------
|
||||||
|
.
|
||||||
|
If it is impossible for You to comply with any of the terms of this
|
||||||
|
License with respect to some or all of the Covered Software due to
|
||||||
|
statute, judicial order, or regulation then You must: (a) comply with
|
||||||
|
the terms of this License to the maximum extent possible; and (b)
|
||||||
|
describe the limitations and the code they affect. Such description must
|
||||||
|
be placed in a text file included with all distributions of the Covered
|
||||||
|
Software under this License. Except to the extent prohibited by statute
|
||||||
|
or regulation, such description must be sufficiently detailed for a
|
||||||
|
recipient of ordinary skill to be able to understand it.
|
||||||
|
.
|
||||||
|
5. Termination
|
||||||
|
--------------
|
||||||
|
.
|
||||||
|
5.1. The rights granted under this License will terminate automatically
|
||||||
|
if You fail to comply with any of its terms. However, if You become
|
||||||
|
compliant, then the rights granted under this License from a particular
|
||||||
|
Contributor are reinstated (a) provisionally, unless and until such
|
||||||
|
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||||
|
ongoing basis, if such Contributor fails to notify You of the
|
||||||
|
non-compliance by some reasonable means prior to 60 days after You have
|
||||||
|
come back into compliance. Moreover, Your grants from a particular
|
||||||
|
Contributor are reinstated on an ongoing basis if such Contributor
|
||||||
|
notifies You of the non-compliance by some reasonable means, this is the
|
||||||
|
first time You have received notice of non-compliance with this License
|
||||||
|
from such Contributor, and You become compliant prior to 30 days after
|
||||||
|
Your receipt of the notice.
|
||||||
|
.
|
||||||
|
5.2. If You initiate litigation against any entity by asserting a patent
|
||||||
|
infringement claim (excluding declaratory judgment actions,
|
||||||
|
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||||
|
directly or indirectly infringes any patent, then the rights granted to
|
||||||
|
You by any and all Contributors for the Covered Software under Section
|
||||||
|
2.1 of this License shall terminate.
|
||||||
|
.
|
||||||
|
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||||
|
end user license agreements (excluding distributors and resellers) which
|
||||||
|
have been validly granted by You or Your distributors under this License
|
||||||
|
prior to termination shall survive termination.
|
||||||
|
.
|
||||||
|
************************************************************************
|
||||||
|
* *
|
||||||
|
* 6. Disclaimer of Warranty *
|
||||||
|
* ------------------------- *
|
||||||
|
* *
|
||||||
|
* Covered Software is provided under this License on an "as is" *
|
||||||
|
* basis, without warranty of any kind, either expressed, implied, or *
|
||||||
|
* statutory, including, without limitation, warranties that the *
|
||||||
|
* Covered Software is free of defects, merchantable, fit for a *
|
||||||
|
* particular purpose or non-infringing. The entire risk as to the *
|
||||||
|
* quality and performance of the Covered Software is with You. *
|
||||||
|
* Should any Covered Software prove defective in any respect, You *
|
||||||
|
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||||
|
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||||
|
* essential part of this License. No use of any Covered Software is *
|
||||||
|
* authorized under this License except under this disclaimer. *
|
||||||
|
* *
|
||||||
|
************************************************************************
|
||||||
|
.
|
||||||
|
************************************************************************
|
||||||
|
* *
|
||||||
|
* 7. Limitation of Liability *
|
||||||
|
* -------------------------- *
|
||||||
|
* *
|
||||||
|
* Under no circumstances and under no legal theory, whether tort *
|
||||||
|
* (including negligence), contract, or otherwise, shall any *
|
||||||
|
* Contributor, or anyone who distributes Covered Software as *
|
||||||
|
* permitted above, be liable to You for any direct, indirect, *
|
||||||
|
* special, incidental, or consequential damages of any character *
|
||||||
|
* including, without limitation, damages for lost profits, loss of *
|
||||||
|
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||||
|
* and all other commercial damages or losses, even if such party *
|
||||||
|
* shall have been informed of the possibility of such damages. This *
|
||||||
|
* limitation of liability shall not apply to liability for death or *
|
||||||
|
* personal injury resulting from such party's negligence to the *
|
||||||
|
* extent applicable law prohibits such limitation. Some *
|
||||||
|
* jurisdictions do not allow the exclusion or limitation of *
|
||||||
|
* incidental or consequential damages, so this exclusion and *
|
||||||
|
* limitation may not apply to You. *
|
||||||
|
* *
|
||||||
|
************************************************************************
|
||||||
|
.
|
||||||
|
8. Litigation
|
||||||
|
-------------
|
||||||
|
.
|
||||||
|
Any litigation relating to this License may be brought only in the
|
||||||
|
courts of a jurisdiction where the defendant maintains its principal
|
||||||
|
place of business and such litigation shall be governed by laws of that
|
||||||
|
jurisdiction, without reference to its conflict-of-law provisions.
|
||||||
|
Nothing in this Section shall prevent a party's ability to bring
|
||||||
|
cross-claims or counter-claims.
|
||||||
|
.
|
||||||
|
9. Miscellaneous
|
||||||
|
----------------
|
||||||
|
.
|
||||||
|
This License represents the complete agreement concerning the subject
|
||||||
|
matter hereof. If any provision of this License is held to be
|
||||||
|
unenforceable, such provision shall be reformed only to the extent
|
||||||
|
necessary to make it enforceable. Any law or regulation which provides
|
||||||
|
that the language of a contract shall be construed against the drafter
|
||||||
|
shall not be used to construe this License against a Contributor.
|
||||||
|
.
|
||||||
|
10. Versions of the License
|
||||||
|
---------------------------
|
||||||
|
.
|
||||||
|
10.1. New Versions
|
||||||
|
.
|
||||||
|
Mozilla Foundation is the license steward. Except as provided in Section
|
||||||
|
10.3, no one other than the license steward has the right to modify or
|
||||||
|
publish new versions of this License. Each version will be given a
|
||||||
|
distinguishing version number.
|
||||||
|
.
|
||||||
|
10.2. Effect of New Versions
|
||||||
|
.
|
||||||
|
You may distribute the Covered Software under the terms of the version
|
||||||
|
of the License under which You originally received the Covered Software,
|
||||||
|
or under the terms of any subsequent version published by the license
|
||||||
|
steward.
|
||||||
|
.
|
||||||
|
10.3. Modified Versions
|
||||||
|
.
|
||||||
|
If you create software not governed by this License, and you want to
|
||||||
|
create a new license for such software, you may create and use a
|
||||||
|
modified version of this License if you rename the license and remove
|
||||||
|
any references to the name of the license steward (except to note that
|
||||||
|
such modified license differs from this License).
|
||||||
|
.
|
||||||
|
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||||
|
Licenses
|
||||||
|
.
|
||||||
|
If You choose to distribute Source Code Form that is Incompatible With
|
||||||
|
Secondary Licenses under the terms of this version of the License, the
|
||||||
|
notice described in Exhibit B of this License must be attached.
|
||||||
|
.
|
||||||
|
Exhibit A - Source Code Form License Notice
|
||||||
|
-------------------------------------------
|
||||||
|
.
|
||||||
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
.
|
||||||
|
If it is not possible or desirable to put the notice in a particular
|
||||||
|
file, then You may include the notice in a location (such as a LICENSE
|
||||||
|
file in a relevant directory) where a recipient would be likely to look
|
||||||
|
for such a notice.
|
||||||
|
.
|
||||||
|
You may add additional accurate notices of copyright ownership.
|
||||||
|
.
|
||||||
|
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||||
|
---------------------------------------------------------
|
||||||
|
.
|
||||||
|
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||||
|
defined by the Mozilla Public License, v. 2.0.
|
||||||
Executable
+12
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/dh-exec
|
||||||
|
|
||||||
|
Tachidesk-Server.jar usr/share/java/tachidesk-server/
|
||||||
|
tachidesk-server.png usr/share/pixmaps/
|
||||||
|
tachidesk-server.desktop usr/share/applications/
|
||||||
|
tachidesk-server.service usr/lib/systemd/system/
|
||||||
|
tachidesk-server.sysusers => usr/lib/sysusers.d/tachidesk-server.conf
|
||||||
|
tachidesk-server.tmpfiles => usr/lib/tmpfiles.d/tachidesk-server.conf
|
||||||
|
tachidesk-server.conf => etc/tachidesk/server.conf
|
||||||
|
tachidesk-server-browser-launcher.sh => usr/bin/tachidesk-server-browser
|
||||||
|
tachidesk-server-debug-launcher.sh => usr/bin/tachidesk-server-debug
|
||||||
|
tachidesk-server-electron-launcher.sh => usr/bin/tachidesk-server-electron
|
||||||
Executable
+11
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/make -f
|
||||||
|
# See debhelper(7) (uncomment to enable)
|
||||||
|
# output every command that modifies files on the build system.
|
||||||
|
#export DH_VERBOSE = 1
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@
|
||||||
|
|
||||||
|
override_dh_strip_nondeterminism:
|
||||||
|
true
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
3.0 (quilt)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
tachidesk-server.png
|
||||||
+86
@@ -0,0 +1,86 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||||
|
<Product Id="*" UpgradeCode="*"
|
||||||
|
Version="$(var.ProductVersion)" Language="1033" Name="Tachidesk Server" Manufacturer="Suwayomi">
|
||||||
|
<Package InstallerVersion="300" Compressed="yes" />
|
||||||
|
<Media Id="1" Cabinet="Tachidesk_Server.cab" EmbedCab="yes" />
|
||||||
|
|
||||||
|
<Condition Message="This version of Windows does not support deploying 64-bit packages.">
|
||||||
|
VersionNT64
|
||||||
|
</Condition>
|
||||||
|
|
||||||
|
<!-- Directory -->
|
||||||
|
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||||
|
<Directory Id="ProgramFiles64Folder">
|
||||||
|
<Directory Id="INSTALLDIR" Name="Tachidesk-Server" >
|
||||||
|
<Directory Id="jre"/>
|
||||||
|
<Directory Id="electron"/>
|
||||||
|
</Directory>
|
||||||
|
</Directory>
|
||||||
|
<Directory Id="ProgramMenuFolder">
|
||||||
|
<Directory Id="ProgramMenuDir" Name="Tachidesk-Server">
|
||||||
|
<Component Id="ProgramMenuDir" Guid="*">
|
||||||
|
<RemoveFolder Id="ProgramMenuDir" On="uninstall"/>
|
||||||
|
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="" KeyPath="yes"/>
|
||||||
|
</Component>
|
||||||
|
</Directory>
|
||||||
|
</Directory>
|
||||||
|
<Directory Id="DesktopFolder" />
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<!-- Component -->
|
||||||
|
<DirectoryRef Id="INSTALLDIR">
|
||||||
|
<Component Id="TachideskJAR" Guid="*" Win64="yes">
|
||||||
|
<File Id="Tachidesk-Server.jar" Source="$(var.SourceDir)/Tachidesk-Server.jar" KeyPath="yes" />
|
||||||
|
</Component>
|
||||||
|
|
||||||
|
<Component Id="TachideskBrowserBAT" Guid="*" Win64="yes">
|
||||||
|
<File Id="TachideskBrowser.bat" Source="$(var.SourceDir)/Tachidesk Browser Launcher.bat" KeyPath="yes" >
|
||||||
|
<Shortcut Id="TachideskBrowser.lnk" Name="Tachidesk Browser" Directory="INSTALLDIR"
|
||||||
|
WorkingDirectory="INSTALLDIR" Icon="Tachidesk.ico" IconIndex="0" Advertise="yes" />
|
||||||
|
<Shortcut Id="DesktopTachideskBrowser.lnk" Name="Tachidesk Browser" Directory="DesktopFolder"
|
||||||
|
WorkingDirectory="INSTALLDIR" Icon="Tachidesk.ico" IconIndex="0" Advertise="yes" />
|
||||||
|
<Shortcut Id="ProgramMenuTachideskBrowser.lnk" Name="Tachidesk Browser" Directory="ProgramMenuDir"
|
||||||
|
WorkingDirectory="INSTALLDIR" Icon="Tachidesk.ico" IconIndex="0" Advertise="yes"
|
||||||
|
Description="A free and open source manga reader that runs extensions built for Tachiyomi." />
|
||||||
|
</File>
|
||||||
|
</Component>
|
||||||
|
|
||||||
|
<Component Id="TachideskDebugBAT" Guid="*" Win64="yes">
|
||||||
|
<File Id="TachideskDebug.bat" Source="$(var.SourceDir)/Tachidesk Debug Launcher.bat" KeyPath="yes">
|
||||||
|
<Shortcut Id="TachideskDebug.lnk" Name="Tachidesk Debug" Directory="INSTALLDIR"
|
||||||
|
WorkingDirectory="INSTALLDIR" Icon="Tachidesk.ico" IconIndex="0" Advertise="yes" />
|
||||||
|
<Shortcut Id="ProgramMenuTachideskDebug.lnk" Name="Tachidesk Debug" Directory="ProgramMenuDir"
|
||||||
|
WorkingDirectory="INSTALLDIR" Icon="Tachidesk.ico" IconIndex="0" Advertise="yes"
|
||||||
|
Description="Launches Tachidesk with debug logs attached. If Tachidesk doesn't work for you, running this can give you insight into why." />
|
||||||
|
</File>
|
||||||
|
</Component>
|
||||||
|
|
||||||
|
<Component Id="TachideskElectronBAT" Guid="*" Win64="yes">
|
||||||
|
<File Id="TachideskElectron.bat" Source="$(var.SourceDir)/Tachidesk Electron Launcher.bat" KeyPath="yes">
|
||||||
|
<Shortcut Id="TachideskElectron.lnk" Name="Tachidesk Electron" Directory="INSTALLDIR"
|
||||||
|
WorkingDirectory="INSTALLDIR" Icon="Tachidesk.ico" IconIndex="0" Advertise="yes" />
|
||||||
|
<Shortcut Id="DesktopTachideskElectron.lnk" Name="Tachidesk Electron" Directory="DesktopFolder"
|
||||||
|
WorkingDirectory="INSTALLDIR" Icon="Tachidesk.ico" IconIndex="0" Advertise="yes" />
|
||||||
|
<Shortcut Id="ProgramMenuTachideskElectron.lnk" Name="Tachidesk Electron" Directory="ProgramMenuDir"
|
||||||
|
WorkingDirectory="INSTALLDIR" Icon="Tachidesk.ico" IconIndex="0" Advertise="yes"
|
||||||
|
Description="Launches Tachidesk inside Electron as a desktop applicaton." />
|
||||||
|
</File>
|
||||||
|
</Component>
|
||||||
|
</DirectoryRef>
|
||||||
|
|
||||||
|
<!-- Feature -->
|
||||||
|
<Feature Id="Tachidesk_Server" Title="Tachidesk-Server" Level="1">
|
||||||
|
<ComponentGroupRef Id="jre" />
|
||||||
|
<ComponentRef Id="TachideskJAR" />
|
||||||
|
<ComponentRef Id="TachideskBrowserBAT" />
|
||||||
|
<ComponentRef Id="TachideskDebugBAT" />
|
||||||
|
<ComponentRef Id="ProgramMenuDir" />
|
||||||
|
<ComponentGroupRef Id="electron" />
|
||||||
|
<ComponentRef Id="TachideskElectronBAT" />
|
||||||
|
</Feature>
|
||||||
|
|
||||||
|
<Icon Id="Tachidesk.ico" SourceFile="$(var.Icon)" />
|
||||||
|
<Property Id="ARPPRODUCTICON" Value="Tachidesk.ico" /> <!-- Icon in Add/Remove Programs -->
|
||||||
|
</Product>
|
||||||
|
</Wix>
|
||||||
+82
@@ -0,0 +1,82 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||||
|
<Product Id="*" UpgradeCode="*"
|
||||||
|
Version="$(var.ProductVersion)" Language="1033" Name="Tachidesk Server" Manufacturer="Suwayomi">
|
||||||
|
<Package InstallerVersion="300" Compressed="yes" />
|
||||||
|
<Media Id="1" Cabinet="Tachidesk_Server.cab" EmbedCab="yes" />
|
||||||
|
|
||||||
|
<!-- Directory -->
|
||||||
|
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||||
|
<Directory Id="ProgramFilesFolder">
|
||||||
|
<Directory Id="INSTALLDIR" Name="Tachidesk-Server" >
|
||||||
|
<Directory Id="jre"/>
|
||||||
|
<Directory Id="electron"/>
|
||||||
|
</Directory>
|
||||||
|
</Directory>
|
||||||
|
<Directory Id="ProgramMenuFolder">
|
||||||
|
<Directory Id="ProgramMenuDir" Name="Tachidesk-Server">
|
||||||
|
<Component Id="ProgramMenuDir" Guid="*">
|
||||||
|
<RemoveFolder Id="ProgramMenuDir" On="uninstall"/>
|
||||||
|
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="" KeyPath="yes"/>
|
||||||
|
</Component>
|
||||||
|
</Directory>
|
||||||
|
</Directory>
|
||||||
|
<Directory Id="DesktopFolder" />
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<!-- Component -->
|
||||||
|
<DirectoryRef Id="INSTALLDIR">
|
||||||
|
<Component Id="TachideskJAR" Guid="*">
|
||||||
|
<File Id="Tachidesk-Server.jar" Source="$(var.SourceDir)/Tachidesk-Server.jar" KeyPath="yes" />
|
||||||
|
</Component>
|
||||||
|
|
||||||
|
<Component Id="TachideskBrowserBAT" Guid="*">
|
||||||
|
<File Id="TachideskBrowser.bat" Source="$(var.SourceDir)/Tachidesk Browser Launcher.bat" KeyPath="yes" >
|
||||||
|
<Shortcut Id="TachideskBrowser.lnk" Name="Tachidesk Browser" Directory="INSTALLDIR"
|
||||||
|
WorkingDirectory="INSTALLDIR" Icon="Tachidesk.ico" IconIndex="0" Advertise="yes" />
|
||||||
|
<Shortcut Id="DesktopTachideskBrowser.lnk" Name="Tachidesk Browser" Directory="DesktopFolder"
|
||||||
|
WorkingDirectory="INSTALLDIR" Icon="Tachidesk.ico" IconIndex="0" Advertise="yes" />
|
||||||
|
<Shortcut Id="ProgramMenuTachideskBrowser.lnk" Name="Tachidesk Browser" Directory="ProgramMenuDir"
|
||||||
|
WorkingDirectory="INSTALLDIR" Icon="Tachidesk.ico" IconIndex="0" Advertise="yes"
|
||||||
|
Description="A free and open source manga reader that runs extensions built for Tachiyomi." />
|
||||||
|
</File>
|
||||||
|
</Component>
|
||||||
|
|
||||||
|
<Component Id="TachideskDebugBAT" Guid="*">
|
||||||
|
<File Id="TachideskDebug.bat" Source="$(var.SourceDir)/Tachidesk Debug Launcher.bat" KeyPath="yes">
|
||||||
|
<Shortcut Id="TachideskDebug.lnk" Name="Tachidesk Debug" Directory="INSTALLDIR"
|
||||||
|
WorkingDirectory="INSTALLDIR" Icon="Tachidesk.ico" IconIndex="0" Advertise="yes" />
|
||||||
|
<Shortcut Id="ProgramMenuTachideskDebug.lnk" Name="Tachidesk Debug" Directory="ProgramMenuDir"
|
||||||
|
WorkingDirectory="INSTALLDIR" Icon="Tachidesk.ico" IconIndex="0" Advertise="yes"
|
||||||
|
Description="Launches Tachidesk with debug logs attached. If Tachidesk doesn't work for you, running this can give you insight into why." />
|
||||||
|
</File>
|
||||||
|
</Component>
|
||||||
|
|
||||||
|
<Component Id="TachideskElectronBAT" Guid="*">
|
||||||
|
<File Id="TachideskElectron.bat" Source="$(var.SourceDir)/Tachidesk Electron Launcher.bat" KeyPath="yes">
|
||||||
|
<Shortcut Id="TachideskElectron.lnk" Name="Tachidesk Electron" Directory="INSTALLDIR"
|
||||||
|
WorkingDirectory="INSTALLDIR" Icon="Tachidesk.ico" IconIndex="0" Advertise="yes" />
|
||||||
|
<Shortcut Id="DesktopTachideskElectron.lnk" Name="Tachidesk Electron" Directory="DesktopFolder"
|
||||||
|
WorkingDirectory="INSTALLDIR" Icon="Tachidesk.ico" IconIndex="0" Advertise="yes" />
|
||||||
|
<Shortcut Id="ProgramMenuTachideskElectron.lnk" Name="Tachidesk Electron" Directory="ProgramMenuDir"
|
||||||
|
WorkingDirectory="INSTALLDIR" Icon="Tachidesk.ico" IconIndex="0" Advertise="yes"
|
||||||
|
Description="Launches Tachidesk inside Electron as a desktop applicaton." />
|
||||||
|
</File>
|
||||||
|
</Component>
|
||||||
|
</DirectoryRef>
|
||||||
|
|
||||||
|
<!-- Feature -->
|
||||||
|
<Feature Id="Tachidesk_Server" Title="Tachidesk-Server" Level="1">
|
||||||
|
<ComponentGroupRef Id="jre" />
|
||||||
|
<ComponentRef Id="TachideskJAR" />
|
||||||
|
<ComponentRef Id="TachideskBrowserBAT" />
|
||||||
|
<ComponentRef Id="TachideskDebugBAT" />
|
||||||
|
<ComponentRef Id="ProgramMenuDir" />
|
||||||
|
<ComponentGroupRef Id="electron" />
|
||||||
|
<ComponentRef Id="TachideskElectronBAT" />
|
||||||
|
</Feature>
|
||||||
|
|
||||||
|
<Icon Id="Tachidesk.ico" SourceFile="$(var.Icon)" />
|
||||||
|
<Property Id="ARPPRODUCTICON" Value="Tachidesk.ico" /> <!-- Icon in Add/Remove Programs -->
|
||||||
|
</Product>
|
||||||
|
</Wix>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
TACHIDESK_ROOT_DIR="/var/lib/tachidesk"
|
||||||
|
|
||||||
|
# Extra arguments passed to the java command
|
||||||
|
# The default value disables the system tray icon, and launching a browser on service start.
|
||||||
|
JAVA_ARGS=-Dsuwayomi.tachidesk.config.server.initialOpenInBrowserEnabled=false -Dsuwayomi.tachidesk.config.server.systemTrayEnabled=false
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=A free and open source manga reader server that runs extensions built for Tachiyomi.
|
||||||
|
Wants=network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=tachidesk
|
||||||
|
Group=tachidesk
|
||||||
|
SyslogIdentifier=tachidesk
|
||||||
|
|
||||||
|
EnvironmentFile=/etc/tachidesk/server.conf
|
||||||
|
ExecStart=/usr/bin/java $JAVA_ARGS -Dsuwayomi.tachidesk.config.server.rootDir="${TACHIDESK_ROOT_DIR}" -jar /usr/share/java/tachidesk-server/Tachidesk-Server.jar
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
ProtectSystem=full
|
||||||
|
ProtectHome=true
|
||||||
|
PrivateTmp=yes
|
||||||
|
PrivateDevices=yes
|
||||||
|
ProtectClock=yes
|
||||||
|
ProtectKernelTunables=yes
|
||||||
|
ProtectKernelModules=yes
|
||||||
|
ProtectKernelLogs=yes
|
||||||
|
ProtectControlGroups=yes
|
||||||
|
RestrictSUIDSGID=yes
|
||||||
|
RestrictRealtime=yes
|
||||||
|
RestrictNamespaces=yes
|
||||||
|
NoNewPrivileges=yes
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#Type Name ID GECOS Home directory Shell
|
||||||
|
u tachidesk - "Tachidesk Manga Server" /var/lib/tachidesk
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#Type Path Mode User Group Age Argument
|
||||||
|
d /var/lib/tachidesk 0755 tachidesk tachidesk
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
exec /usr/bin/java -jar /usr/share/java/tachidesk-server/Tachidesk-Server.jar
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
exec /usr/bin/java \
|
||||||
|
-Dsuwayomi.tachidesk.config.server.debugLogsEnabled=true \
|
||||||
|
-jar /usr/share/java/tachidesk-server/Tachidesk-Server.jar
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ ! -f /usr/bin/electron ]; then
|
||||||
|
echo "Electron executable was not found!
|
||||||
|
In order to run this launcher, you need Electron installed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec /usr/bin/java \
|
||||||
|
-Dsuwayomi.tachidesk.config.server.webUIInterface=electron \
|
||||||
|
-Dsuwayomi.tachidesk.config.server.electronPath=/usr/bin/electron \
|
||||||
|
-jar /usr/share/java/tachidesk-server/Tachidesk-Server.jar
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=Tachidesk-Server
|
||||||
|
Comment=Manga Reader
|
||||||
|
Exec=/usr/bin/java -jar /usr/share/java/tachidesk-server/Tachidesk-Server.jar "\\$@"
|
||||||
|
Icon=tachidesk-server
|
||||||
|
Terminal=false
|
||||||
|
Categories=Network;
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
./jre/bin/java -jar Tachidesk.jar
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
./jre/bin/java -Dsuwayomi.tachidesk.config.server.debugLogsEnabled=true -jar Tachidesk.jar
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
./jre/bin/java "-Dsuwayomi.tachidesk.config.server.webUIInterface=electron" "-Dsuwayomi.tachidesk.config.server.electronPath=electron/electron" -jar Tachidesk.jar
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
exec ./jre/bin/java -jar ./Tachidesk-Server.jar
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
exec ./jre/bin/java \
|
||||||
|
-Dsuwayomi.tachidesk.config.server.debugLogsEnabled=true \
|
||||||
|
-jar ./Tachidesk-Server.jar
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
exec ./jre/bin/java \
|
||||||
|
-Dsuwayomi.tachidesk.config.server.webUIInterface=electron \
|
||||||
|
-Dsuwayomi.tachidesk.config.server.electronPath=./electron/electron \
|
||||||
|
-jar ./Tachidesk-Server.jar
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
#/bin/bash
|
|
||||||
|
|
||||||
# Copyright (C) Contributors to the Suwayomi project
|
|
||||||
#
|
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
||||||
|
|
||||||
electron_version="v14.0.0"
|
|
||||||
|
|
||||||
if [ $1 = "linux-x64" ]; then
|
|
||||||
jre="OpenJDK8U-jre_x64_linux_hotspot_8u302b08.tar.gz"
|
|
||||||
jre_release="jdk8u302-b08"
|
|
||||||
jre_url="https://github.com/adoptium/temurin8-binaries/releases/download/$jre_release/$jre"
|
|
||||||
jre_dir="$jre_release-jre"
|
|
||||||
electron="electron-$electron_version-linux-x64.zip"
|
|
||||||
elif [ $1 = "macOS-x64" ]; then
|
|
||||||
jre="OpenJDK8U-jre_x64_mac_hotspot_8u302b08.tar.gz"
|
|
||||||
jre_release="jdk8u302-b08"
|
|
||||||
jre_url="https://github.com/adoptium/temurin8-binaries/releases/download/$jre_release/$jre"
|
|
||||||
jre_dir="$jre_release-jre"
|
|
||||||
electron="electron-$electron_version-darwin-x64.zip"
|
|
||||||
elif [ $1 = "macOS-arm64" ]; then
|
|
||||||
jre="zulu8.56.0.23-ca-jre8.0.302-macosx_aarch64.tar.gz"
|
|
||||||
jre_release="zulu8.56.0.23-ca-jre8.0.302-macosx_aarch64"
|
|
||||||
jre_url="https://cdn.azul.com/zulu/bin/$jre"
|
|
||||||
jre_dir="$jre_release/zulu-8.jre"
|
|
||||||
electron="electron-$electron_version-darwin-arm64.zip"
|
|
||||||
else
|
|
||||||
echo "Unsupported arch value: $1"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
arch="$1"
|
|
||||||
os=$(echo $arch | cut -d '-' -f1)
|
|
||||||
|
|
||||||
echo "creating $arch bundle"
|
|
||||||
|
|
||||||
jar=$(ls ../server/build/*.jar | tail -n1)
|
|
||||||
jar_name=$(echo $jar | cut -d'/' -f4)
|
|
||||||
release_name=$(echo $jar_name | sed 's/.jar//')-$arch
|
|
||||||
|
|
||||||
|
|
||||||
# make release dir
|
|
||||||
mkdir $release_name
|
|
||||||
|
|
||||||
|
|
||||||
echo "Dealing with jre..."
|
|
||||||
if [ ! -f $jre ]; then
|
|
||||||
curl -L $jre_url -o $jre
|
|
||||||
fi
|
|
||||||
tar xvf $jre
|
|
||||||
mv $jre_dir $release_name/jre
|
|
||||||
|
|
||||||
echo "Dealing with electron"
|
|
||||||
if [ ! -f $electron ]; then
|
|
||||||
curl -L "https://github.com/electron/electron/releases/download/$electron_version/$electron" -o $electron
|
|
||||||
fi
|
|
||||||
unzip $electron -d $release_name/electron
|
|
||||||
|
|
||||||
# copy artifacts
|
|
||||||
cp $jar $release_name/Tachidesk.jar
|
|
||||||
if [ $os = linux ]; then
|
|
||||||
cp "resources/tachidesk-browser-launcher.sh" $release_name
|
|
||||||
cp "resources/tachidesk-debug-launcher.sh" $release_name
|
|
||||||
cp "resources/tachidesk-electron-launcher.sh" $release_name
|
|
||||||
elif [ $os = macOS ]; then
|
|
||||||
cp "resources/Tachidesk Browser Launcher.command" $release_name
|
|
||||||
cp "resources/Tachidesk Debug Launcher.command" $release_name
|
|
||||||
cp "resources/Tachidesk Electron Launcher.command" $release_name
|
|
||||||
fi
|
|
||||||
|
|
||||||
archive_name=""
|
|
||||||
if [ $os = linux ]; then
|
|
||||||
archive_name=$release_name.tar.gz
|
|
||||||
GZIP=-9 tar cvzf $archive_name $release_name
|
|
||||||
elif [ $os = macOS ]; then
|
|
||||||
archive_name=$release_name.zip
|
|
||||||
zip -9 -r $archive_name $release_name
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -rf $release_name
|
|
||||||
|
|
||||||
# clean up from possible previous runs
|
|
||||||
if [ -f ../server/build/$archive_name ]; then
|
|
||||||
rm ../server/build/$archive_name
|
|
||||||
fi
|
|
||||||
|
|
||||||
mv $archive_name ../server/build/
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Copyright (C) Contributors to the Suwayomi project
|
|
||||||
#
|
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
||||||
|
|
||||||
electron_version="v14.0.0"
|
|
||||||
|
|
||||||
if [ $1 = "win32" ]; then
|
|
||||||
jre="OpenJDK8U-jre_x86-32_windows_hotspot_8u292b10.zip"
|
|
||||||
jre_release="jdk8u292-b10"
|
|
||||||
jre_url="https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/$jre_release/$jre"
|
|
||||||
arch="windows-x86"
|
|
||||||
electron="electron-$electron_version-win32-ia32.zip"
|
|
||||||
else
|
|
||||||
jre="OpenJDK8U-jre_x64_windows_hotspot_8u302b08.zip"
|
|
||||||
jre_release="jdk8u302-b08"
|
|
||||||
jre_url="https://github.com/adoptium/temurin8-binaries/releases/download/$jre_release/$jre"
|
|
||||||
arch="windows-x64"
|
|
||||||
electron="electron-$electron_version-win32-x64.zip"
|
|
||||||
fi
|
|
||||||
|
|
||||||
jre_dir="$jre_release-jre"
|
|
||||||
|
|
||||||
echo "creating windows bundle"
|
|
||||||
|
|
||||||
jar=$(ls ../server/build/*.jar | tail -n1)
|
|
||||||
jar_name=$(echo $jar | cut -d'/' -f4)
|
|
||||||
release_name=$(echo $jar_name | sed 's/.jar//')-$arch
|
|
||||||
|
|
||||||
|
|
||||||
# make release dir
|
|
||||||
mkdir $release_name
|
|
||||||
|
|
||||||
|
|
||||||
echo "Dealing with jre..."
|
|
||||||
if [ ! -f $jre ]; then
|
|
||||||
curl -L $jre_url -o $jre
|
|
||||||
fi
|
|
||||||
unzip $jre
|
|
||||||
mv $jre_dir $release_name/jre
|
|
||||||
|
|
||||||
echo "Dealing with electron"
|
|
||||||
if [ ! -f $electron ]; then
|
|
||||||
curl -L "https://github.com/electron/electron/releases/download/$electron_version/$electron" -o $electron
|
|
||||||
fi
|
|
||||||
unzip $electron -d $release_name/electron
|
|
||||||
|
|
||||||
# change electron's icon
|
|
||||||
rcedit="rcedit-x86.exe"
|
|
||||||
if [ ! -f $rcedit ]; then
|
|
||||||
curl -L "https://github.com/electron/rcedit/releases/download/v1.1.1/$rcedit" -o $rcedit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if running under github actions
|
|
||||||
if [ $CI = true ]; then
|
|
||||||
# change electron executable's icon
|
|
||||||
sudo dpkg --add-architecture i386
|
|
||||||
wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
|
|
||||||
sudo add-apt-repository ppa:cybermax-dexter/sdl2-backport
|
|
||||||
sudo apt-add-repository "deb https://dl.winehq.org/wine-builds/ubuntu $(lsb_release -cs) main"
|
|
||||||
sudo apt install --install-recommends winehq-stable
|
|
||||||
fi
|
|
||||||
# this script assumes that wine is installed here on out
|
|
||||||
|
|
||||||
WINEARCH=win32 wine $rcedit $release_name/electron/electron.exe --set-icon ../server/src/main/resources/icon/faviconlogo.ico
|
|
||||||
|
|
||||||
# copy artifacts
|
|
||||||
cp $jar $release_name/Tachidesk.jar
|
|
||||||
cp "resources/Tachidesk Browser Launcher.bat" $release_name
|
|
||||||
cp "resources/Tachidesk Debug Launcher.bat" $release_name
|
|
||||||
cp "resources/Tachidesk Electron Launcher.bat" $release_name
|
|
||||||
|
|
||||||
zip_name=$release_name.zip
|
|
||||||
zip -9 -r $zip_name $release_name
|
|
||||||
|
|
||||||
rm -rf $release_name
|
|
||||||
|
|
||||||
# clean up from possible previous runs
|
|
||||||
if [ -f ../server/build/$zip_name ]; then
|
|
||||||
rm ../server/build/$zip_name
|
|
||||||
fi
|
|
||||||
|
|
||||||
mv $zip_name ../server/build/
|
|
||||||
+37
-42
@@ -1,81 +1,76 @@
|
|||||||
import de.undercouch.gradle.tasks.download.Download
|
import de.undercouch.gradle.tasks.download.Download
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
|
|
||||||
|
@Suppress("DSL_SCOPE_VIOLATION")
|
||||||
plugins {
|
plugins {
|
||||||
|
id(libs.plugins.kotlin.jvm.get().pluginId)
|
||||||
|
id(libs.plugins.kotlin.serialization.get().pluginId)
|
||||||
|
id(libs.plugins.kotlinter.get().pluginId)
|
||||||
application
|
application
|
||||||
id("com.github.johnrengelman.shadow") version "7.0.0"
|
alias(libs.plugins.shadowjar)
|
||||||
id("com.github.gmazzo.buildconfig")
|
id(libs.plugins.buildconfig.get().pluginId)
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// okhttp
|
// Shared
|
||||||
val okhttpVersion = "4.9.1" // version is locked by Tachiyomi extensions
|
implementation(libs.bundles.shared)
|
||||||
implementation("com.squareup.okhttp3:okhttp:$okhttpVersion")
|
testImplementation(libs.bundles.sharedTest)
|
||||||
implementation("com.squareup.okhttp3:logging-interceptor:$okhttpVersion")
|
|
||||||
implementation("com.squareup.okhttp3:okhttp-dnsoverhttps:$okhttpVersion")
|
// OkHttp
|
||||||
implementation("com.squareup.okio:okio:2.10.0")
|
implementation(libs.bundles.okhttp)
|
||||||
|
implementation(libs.okio)
|
||||||
|
|
||||||
// Javalin api
|
// Javalin api
|
||||||
implementation("io.javalin:javalin:4.1.1")
|
implementation(libs.bundles.javalin)
|
||||||
implementation("io.javalin:javalin-openapi:4.1.1")
|
implementation(libs.bundles.jackson)
|
||||||
// jackson version locked by javalin, ref: `io.javalin.core.util.OptionalDependency`
|
|
||||||
val jacksonVersion = "2.12.4"
|
|
||||||
implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion")
|
|
||||||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion")
|
|
||||||
|
|
||||||
// Exposed ORM
|
// Exposed ORM
|
||||||
val exposedVersion = "0.34.1"
|
implementation(libs.bundles.exposed)
|
||||||
implementation("org.jetbrains.exposed:exposed-core:$exposedVersion")
|
implementation(libs.h2)
|
||||||
implementation("org.jetbrains.exposed:exposed-dao:$exposedVersion")
|
|
||||||
implementation("org.jetbrains.exposed:exposed-jdbc:$exposedVersion")
|
|
||||||
implementation("org.jetbrains.exposed:exposed-java-time:$exposedVersion")
|
|
||||||
// current database driver
|
|
||||||
implementation("com.h2database:h2:1.4.200")
|
|
||||||
|
|
||||||
// Exposed Migrations
|
// Exposed Migrations
|
||||||
implementation("com.github.Suwayomi:exposed-migrations:3.1.4")
|
implementation(libs.exposed.migrations)
|
||||||
|
|
||||||
// tray icon
|
// tray icon
|
||||||
implementation("com.dorkbox:SystemTray:4.1")
|
implementation(libs.bundles.systemtray)
|
||||||
implementation("com.dorkbox:Utilities:1.9") // version locked by SystemTray
|
|
||||||
|
|
||||||
// dependencies of Tachiyomi extensions, some are duplicate, keeping it here for reference
|
// dependencies of Tachiyomi extensions, some are duplicate, keeping it here for reference
|
||||||
implementation("com.github.inorichi.injekt:injekt-core:65b0440")
|
implementation(libs.injekt)
|
||||||
implementation("com.squareup.okhttp3:okhttp:4.9.1")
|
implementation(libs.okhttp.core)
|
||||||
implementation("io.reactivex:rxjava:1.3.8")
|
implementation(libs.rxjava)
|
||||||
implementation("org.jsoup:jsoup:1.14.2")
|
implementation(libs.jsoup)
|
||||||
implementation("com.google.code.gson:gson:2.8.8")
|
|
||||||
implementation("com.github.salomonbrys.kotson:kotson:2.5.0")
|
|
||||||
|
|
||||||
// Sort
|
// Sort
|
||||||
implementation("com.github.gpanther:java-nat-sort:natural-comparator-1.1")
|
implementation(libs.sort)
|
||||||
|
|
||||||
// asm for ByteCodeEditor(fixing SimpleDateFormat) (must match Dex2Jar version)
|
// asm for ByteCodeEditor(fixing SimpleDateFormat) (must match Dex2Jar version)
|
||||||
implementation("org.ow2.asm:asm:9.2")
|
implementation(libs.asm)
|
||||||
|
|
||||||
// Disk & File
|
// Disk & File
|
||||||
implementation("net.lingala.zip4j:zip4j:2.9.0")
|
implementation(libs.zip4j)
|
||||||
implementation("com.github.junrar:junrar:7.4.0")
|
implementation(libs.junrar)
|
||||||
|
|
||||||
// CloudflareInterceptor
|
// CloudflareInterceptor
|
||||||
implementation("net.sourceforge.htmlunit:htmlunit:2.52.0")
|
implementation(libs.playwright)
|
||||||
|
|
||||||
// Source models and interfaces from Tachiyomi 1.x
|
// AES/CBC/PKCS7Padding Cypher provider for zh.copymanga
|
||||||
// using source class from tachiyomi commit 9493577de27c40ce8b2b6122cc447d025e34c477 to not depend on tachiyomi.sourceapi
|
implementation(libs.bouncycastle)
|
||||||
// implementation("tachiyomi.sourceapi:source-api:1.1")
|
|
||||||
|
|
||||||
// AndroidCompat
|
// AndroidCompat
|
||||||
implementation(project(":AndroidCompat"))
|
implementation(projects.androidCompat)
|
||||||
implementation(project(":AndroidCompat:Config"))
|
implementation(projects.androidCompat.config)
|
||||||
|
|
||||||
// uncomment to test extensions directly
|
// uncomment to test extensions directly
|
||||||
// implementation(fileTree("lib/"))
|
// implementation(fileTree("lib/"))
|
||||||
implementation(kotlin("script-runtime"))
|
implementation(kotlin("script-runtime"))
|
||||||
|
|
||||||
testImplementation("io.mockk:mockk:1.9.3")
|
testImplementation(libs.mockk)
|
||||||
}
|
}
|
||||||
|
|
||||||
application {
|
application {
|
||||||
|
applicationDefaultJvmArgs = listOf(
|
||||||
|
"-Djunrar.extractor.thread-keep-alive-seconds=30"
|
||||||
|
)
|
||||||
mainClass.set(MainClass)
|
mainClass.set(MainClass)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +101,7 @@ buildConfig {
|
|||||||
buildConfigField("String", "WEBUI_TAG", quoteWrap(webUIRevisionTag))
|
buildConfigField("String", "WEBUI_TAG", quoteWrap(webUIRevisionTag))
|
||||||
|
|
||||||
|
|
||||||
buildConfigField("String", "GITHUB", quoteWrap("https://github.com/Suwayomi/Tachidesk"))
|
buildConfigField("String", "GITHUB", quoteWrap("https://github.com/Suwayomi/Tachidesk-Server"))
|
||||||
buildConfigField("String", "DISCORD", quoteWrap("https://discord.gg/DDZdqZWaHA"))
|
buildConfigField("String", "DISCORD", quoteWrap("https://discord.gg/DDZdqZWaHA"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,212 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Microsoft Corporation.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package suwayomi.tachidesk.server.util;
|
||||||
|
|
||||||
|
import com.microsoft.playwright.impl.driver.Driver;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.nio.file.*;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy of <a href="https://github.com/microsoft/playwright-java/blob/8c0231b0f739656e8a86bc58fca9ee778ddc571b/driver-bundle/src/main/java/com/microsoft/playwright/impl/driver/jar/DriverJar.java">DriverJar</a>
|
||||||
|
* with support for pre-installing chromium and only supports chromium playwright
|
||||||
|
*/
|
||||||
|
public class DriverJar extends Driver {
|
||||||
|
private static final String PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD";
|
||||||
|
private static final String SELENIUM_REMOTE_URL = "SELENIUM_REMOTE_URL";
|
||||||
|
static final String PLAYWRIGHT_NODEJS_PATH = "PLAYWRIGHT_NODEJS_PATH";
|
||||||
|
private final Path driverTempDir;
|
||||||
|
private Path preinstalledNodePath;
|
||||||
|
|
||||||
|
public DriverJar() throws IOException {
|
||||||
|
// Allow specifying custom path for the driver installation
|
||||||
|
// See https://github.com/microsoft/playwright-java/issues/728
|
||||||
|
String alternativeTmpdir = System.getProperty("playwright.driver.tmpdir");
|
||||||
|
String prefix = "playwright-java-";
|
||||||
|
driverTempDir = alternativeTmpdir == null
|
||||||
|
? Files.createTempDirectory(prefix)
|
||||||
|
: Files.createTempDirectory(Paths.get(alternativeTmpdir), prefix);
|
||||||
|
driverTempDir.toFile().deleteOnExit();
|
||||||
|
String nodePath = System.getProperty("playwright.nodejs.path");
|
||||||
|
if (nodePath != null) {
|
||||||
|
preinstalledNodePath = Paths.get(nodePath);
|
||||||
|
if (!Files.exists(preinstalledNodePath)) {
|
||||||
|
throw new RuntimeException("Invalid Node.js path specified: " + nodePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logMessage("created DriverJar: " + driverTempDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initialize(Boolean installBrowsers) throws Exception {
|
||||||
|
if (preinstalledNodePath == null && env.containsKey(PLAYWRIGHT_NODEJS_PATH)) {
|
||||||
|
preinstalledNodePath = Paths.get(env.get(PLAYWRIGHT_NODEJS_PATH));
|
||||||
|
if (!Files.exists(preinstalledNodePath)) {
|
||||||
|
throw new RuntimeException("Invalid Node.js path specified: " + preinstalledNodePath);
|
||||||
|
}
|
||||||
|
} else if (preinstalledNodePath != null) {
|
||||||
|
// Pass the env variable to the driver process.
|
||||||
|
env.put(PLAYWRIGHT_NODEJS_PATH, preinstalledNodePath.toString());
|
||||||
|
}
|
||||||
|
extractDriverToTempDir();
|
||||||
|
logMessage("extracted driver from jar to " + driverPath());
|
||||||
|
if (installBrowsers)
|
||||||
|
installBrowsers(env);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void installBrowsers(Map<String, String> env) throws IOException, InterruptedException {
|
||||||
|
String skip = env.get(PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD);
|
||||||
|
if (skip == null) {
|
||||||
|
skip = System.getenv(PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD);
|
||||||
|
}
|
||||||
|
if (skip != null && !"0".equals(skip) && !"false".equals(skip)) {
|
||||||
|
System.out.println("Skipping browsers download because `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` env variable is set");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (env.get(SELENIUM_REMOTE_URL) != null || System.getenv(SELENIUM_REMOTE_URL) != null) {
|
||||||
|
logMessage("Skipping browsers download because `SELENIUM_REMOTE_URL` env variable is set");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Chromium.preinstall(platformDir());
|
||||||
|
Path driver = driverPath();
|
||||||
|
if (!Files.exists(driver)) {
|
||||||
|
throw new RuntimeException("Failed to find driver: " + driver);
|
||||||
|
}
|
||||||
|
ProcessBuilder pb = createProcessBuilder();
|
||||||
|
pb.command().add("install");
|
||||||
|
pb.command().add("chromium");
|
||||||
|
pb.redirectError(ProcessBuilder.Redirect.INHERIT);
|
||||||
|
pb.redirectOutput(ProcessBuilder.Redirect.INHERIT);
|
||||||
|
Process p = pb.start();
|
||||||
|
boolean result = p.waitFor(10, TimeUnit.MINUTES);
|
||||||
|
if (!result) {
|
||||||
|
p.destroy();
|
||||||
|
throw new RuntimeException("Timed out waiting for browsers to install");
|
||||||
|
}
|
||||||
|
if (p.exitValue() != 0) {
|
||||||
|
throw new RuntimeException("Failed to install browsers, exit code: " + p.exitValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isExecutable(Path filePath) {
|
||||||
|
String name = filePath.getFileName().toString();
|
||||||
|
return name.endsWith(".sh") || name.endsWith(".exe") || !name.contains(".");
|
||||||
|
}
|
||||||
|
|
||||||
|
private FileSystem initFileSystem(URI uri) throws IOException {
|
||||||
|
try {
|
||||||
|
return FileSystems.newFileSystem(uri, Collections.emptyMap());
|
||||||
|
} catch (FileSystemAlreadyExistsException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static URI getDriverResourceURI() throws URISyntaxException {
|
||||||
|
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
|
||||||
|
return classloader.getResource("driver/" + platformDir()).toURI();
|
||||||
|
}
|
||||||
|
|
||||||
|
void extractDriverToTempDir() throws URISyntaxException, IOException {
|
||||||
|
URI originalUri = getDriverResourceURI();
|
||||||
|
URI uri = maybeExtractNestedJar(originalUri);
|
||||||
|
|
||||||
|
// Create zip filesystem if loading from jar.
|
||||||
|
try (FileSystem fileSystem = "jar".equals(uri.getScheme()) ? initFileSystem(uri) : null) {
|
||||||
|
Path srcRoot = Paths.get(uri);
|
||||||
|
// jar file system's .relativize gives wrong results when used with
|
||||||
|
// spring-boot-maven-plugin, convert to the default filesystem to
|
||||||
|
// have predictable results.
|
||||||
|
// See https://github.com/microsoft/playwright-java/issues/306
|
||||||
|
Path srcRootDefaultFs = Paths.get(srcRoot.toString());
|
||||||
|
Files.walk(srcRoot).forEach(fromPath -> {
|
||||||
|
if (preinstalledNodePath != null) {
|
||||||
|
String fileName = fromPath.getFileName().toString();
|
||||||
|
if ("node.exe".equals(fileName) || "node".equals(fileName)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Path relative = srcRootDefaultFs.relativize(Paths.get(fromPath.toString()));
|
||||||
|
Path toPath = driverTempDir.resolve(relative.toString());
|
||||||
|
try {
|
||||||
|
if (Files.isDirectory(fromPath)) {
|
||||||
|
Files.createDirectories(toPath);
|
||||||
|
} else {
|
||||||
|
Files.copy(fromPath, toPath);
|
||||||
|
if (isExecutable(toPath)) {
|
||||||
|
toPath.toFile().setExecutable(true, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
toPath.toFile().deleteOnExit();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException("Failed to extract driver from " + uri + ", full uri: " + originalUri, e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private URI maybeExtractNestedJar(final URI uri) throws URISyntaxException {
|
||||||
|
if (!"jar".equals(uri.getScheme())) {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
final String JAR_URL_SEPARATOR = "!/";
|
||||||
|
String[] parts = uri.toString().split("!/");
|
||||||
|
if (parts.length != 3) {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
String innerJar = String.join(JAR_URL_SEPARATOR, parts[0], parts[1]);
|
||||||
|
URI jarUri = new URI(innerJar);
|
||||||
|
try (FileSystem fs = FileSystems.newFileSystem(jarUri, Collections.emptyMap())) {
|
||||||
|
Path fromPath = Paths.get(jarUri);
|
||||||
|
Path toPath = driverTempDir.resolve(fromPath.getFileName().toString());
|
||||||
|
Files.copy(fromPath, toPath);
|
||||||
|
toPath.toFile().deleteOnExit();
|
||||||
|
return new URI("jar:" + toPath.toUri() + JAR_URL_SEPARATOR + parts[2]);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException("Failed to extract driver's nested .jar from " + jarUri + "; full uri: " + uri, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String platformDir() {
|
||||||
|
String name = System.getProperty("os.name").toLowerCase();
|
||||||
|
String arch = System.getProperty("os.arch").toLowerCase();
|
||||||
|
|
||||||
|
if (name.contains("windows")) {
|
||||||
|
return "win32_x64";
|
||||||
|
}
|
||||||
|
if (name.contains("linux")) {
|
||||||
|
if (arch.equals("aarch64")) {
|
||||||
|
return "linux-arm64";
|
||||||
|
} else {
|
||||||
|
return "linux";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (name.contains("mac os x")) {
|
||||||
|
return "mac";
|
||||||
|
}
|
||||||
|
throw new RuntimeException("Unexpected os.name value: " + name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Path driverDir() {
|
||||||
|
return driverTempDir;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package eu.kanade.tachiyomi
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by extensions.
|
||||||
|
*
|
||||||
|
* @since extension-lib 1.3
|
||||||
|
*/
|
||||||
|
object AppInfo {
|
||||||
|
/** should be something like 74 */
|
||||||
|
fun getVersionCode() = suwayomi.tachidesk.server.BuildConfig.REVISION.substring(1).toInt()
|
||||||
|
|
||||||
|
/** should be something like "0.13.1" */
|
||||||
|
fun getVersionName() = suwayomi.tachidesk.server.BuildConfig.VERSION.substring(1)
|
||||||
|
}
|
||||||
@@ -7,8 +7,6 @@ package eu.kanade.tachiyomi
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import android.app.Application
|
|
||||||
import com.google.gson.Gson
|
|
||||||
// import eu.kanade.tachiyomi.data.cache.ChapterCache
|
// import eu.kanade.tachiyomi.data.cache.ChapterCache
|
||||||
// import eu.kanade.tachiyomi.data.cache.CoverCache
|
// import eu.kanade.tachiyomi.data.cache.CoverCache
|
||||||
// import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
// import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||||
@@ -17,6 +15,8 @@ import com.google.gson.Gson
|
|||||||
// import eu.kanade.tachiyomi.data.sync.LibrarySyncManager
|
// import eu.kanade.tachiyomi.data.sync.LibrarySyncManager
|
||||||
// import eu.kanade.tachiyomi.data.track.TrackManager
|
// import eu.kanade.tachiyomi.data.track.TrackManager
|
||||||
// import eu.kanade.tachiyomi.extension.ExtensionManager
|
// import eu.kanade.tachiyomi.extension.ExtensionManager
|
||||||
|
import android.app.Application
|
||||||
|
import eu.kanade.tachiyomi.network.JavaScriptEngine
|
||||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
@@ -30,7 +30,6 @@ import uy.kohesive.injekt.api.get
|
|||||||
class AppModule(val app: Application) : InjektModule {
|
class AppModule(val app: Application) : InjektModule {
|
||||||
|
|
||||||
override fun InjektRegistrar.registerInjectables() {
|
override fun InjektRegistrar.registerInjectables() {
|
||||||
|
|
||||||
addSingleton(app)
|
addSingleton(app)
|
||||||
|
|
||||||
// addSingletonFactory { PreferencesHelper(app) }
|
// addSingletonFactory { PreferencesHelper(app) }
|
||||||
@@ -43,6 +42,8 @@ class AppModule(val app: Application) : InjektModule {
|
|||||||
|
|
||||||
addSingletonFactory { NetworkHelper(app) }
|
addSingletonFactory { NetworkHelper(app) }
|
||||||
|
|
||||||
|
addSingletonFactory { JavaScriptEngine(app) }
|
||||||
|
|
||||||
// addSingletonFactory { SourceManager(app).also { get<ExtensionManager>().init(it) } }
|
// addSingletonFactory { SourceManager(app).also { get<ExtensionManager>().init(it) } }
|
||||||
//
|
//
|
||||||
// addSingletonFactory { ExtensionManager(app) }
|
// addSingletonFactory { ExtensionManager(app) }
|
||||||
@@ -53,8 +54,6 @@ class AppModule(val app: Application) : InjektModule {
|
|||||||
//
|
//
|
||||||
// addSingletonFactory { LibrarySyncManager(app) }
|
// addSingletonFactory { LibrarySyncManager(app) }
|
||||||
|
|
||||||
addSingletonFactory { Gson() }
|
|
||||||
|
|
||||||
addSingletonFactory { Json { ignoreUnknownKeys = true } }
|
addSingletonFactory { Json { ignoreUnknownKeys = true } }
|
||||||
|
|
||||||
// Asynchronously init expensive components for a faster cold start
|
// Asynchronously init expensive components for a faster cold start
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
package eu.kanade.tachiyomi;
|
|
||||||
|
|
||||||
public class BuildConfig {
|
|
||||||
public static final int VERSION_CODE = -1;
|
|
||||||
public static final String VERSION_NAME = "stub";
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package eu.kanade.tachiyomi.network
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import app.cash.quickjs.QuickJs
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Util for evaluating JavaScript in sources.
|
||||||
|
*/
|
||||||
|
class JavaScriptEngine(context: Context) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Evaluate arbitrary JavaScript code and get the result as a primitive type
|
||||||
|
* (e.g., String, Int).
|
||||||
|
*
|
||||||
|
* @since extensions-lib 1.4
|
||||||
|
* @param script JavaScript to execute.
|
||||||
|
* @return Result of JavaScript code as a primitive type.
|
||||||
|
*/
|
||||||
|
@Suppress("UNUSED", "UNCHECKED_CAST")
|
||||||
|
suspend fun <T> evaluate(script: String): T = withContext(Dispatchers.IO) {
|
||||||
|
QuickJs.create().use {
|
||||||
|
it.evaluate(script) as T
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,6 +39,7 @@ class NetworkHelper(context: Context) {
|
|||||||
.cookieJar(cookieManager)
|
.cookieJar(cookieManager)
|
||||||
.connectTimeout(30, TimeUnit.SECONDS)
|
.connectTimeout(30, TimeUnit.SECONDS)
|
||||||
.readTimeout(30, TimeUnit.SECONDS)
|
.readTimeout(30, TimeUnit.SECONDS)
|
||||||
|
.callTimeout(2, TimeUnit.MINUTES)
|
||||||
.addInterceptor(UserAgentInterceptor())
|
.addInterceptor(UserAgentInterceptor())
|
||||||
|
|
||||||
if (serverConfig.debugLogsEnabled) {
|
if (serverConfig.debugLogsEnabled) {
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package eu.kanade.tachiyomi.network
|
package eu.kanade.tachiyomi.network
|
||||||
|
|
||||||
// import kotlinx.coroutines.suspendCancellableCoroutine
|
|
||||||
import kotlinx.coroutines.suspendCancellableCoroutine
|
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
import okhttp3.Call
|
import okhttp3.Call
|
||||||
import okhttp3.Callback
|
import okhttp3.Callback
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
@@ -11,6 +12,8 @@ import okhttp3.internal.closeQuietly
|
|||||||
import rx.Observable
|
import rx.Observable
|
||||||
import rx.Producer
|
import rx.Producer
|
||||||
import rx.Subscription
|
import rx.Subscription
|
||||||
|
import uy.kohesive.injekt.Injekt
|
||||||
|
import uy.kohesive.injekt.api.fullType
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
import kotlin.coroutines.resumeWithException
|
import kotlin.coroutines.resumeWithException
|
||||||
@@ -59,7 +62,7 @@ suspend fun Call.await(): Response {
|
|||||||
object : Callback {
|
object : Callback {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
if (!response.isSuccessful) {
|
if (!response.isSuccessful) {
|
||||||
continuation.resumeWithException(Exception("HTTP error ${response.code}"))
|
continuation.resumeWithException(HttpException(response.code))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +94,7 @@ fun Call.asObservableSuccess(): Observable<Response> {
|
|||||||
.doOnNext { response ->
|
.doOnNext { response ->
|
||||||
if (!response.isSuccessful) {
|
if (!response.isSuccessful) {
|
||||||
response.close()
|
response.close()
|
||||||
throw Exception("HTTP error ${response.code}")
|
throw HttpException(response.code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,14 +116,25 @@ fun Call.asObservableSuccess(): Observable<Response> {
|
|||||||
@Suppress("UNUSED_PARAMETER")
|
@Suppress("UNUSED_PARAMETER")
|
||||||
fun OkHttpClient.newCallWithProgress(request: Request, listener: ProgressListener): Call {
|
fun OkHttpClient.newCallWithProgress(request: Request, listener: ProgressListener): Call {
|
||||||
val progressClient = newBuilder()
|
val progressClient = newBuilder()
|
||||||
// .cache(null)
|
.cache(null)
|
||||||
// .addNetworkInterceptor { chain ->
|
.addNetworkInterceptor { chain ->
|
||||||
// val originalResponse = chain.proceed(chain.request())
|
val originalResponse = chain.proceed(chain.request())
|
||||||
// originalResponse.newBuilder()
|
originalResponse.newBuilder()
|
||||||
// .body(ProgressResponseBody(originalResponse.body!!, listener))
|
.body(ProgressResponseBody(originalResponse.body!!, listener))
|
||||||
// .build()
|
.build()
|
||||||
// }
|
}
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
return progressClient.newCall(request)
|
return progressClient.newCall(request)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline fun <reified T> Response.parseAs(): T {
|
||||||
|
// Avoiding Injekt.get<Json>() due to compiler issues
|
||||||
|
val json = Injekt.getInstance<Json>(fullType<Json>().type)
|
||||||
|
this.use {
|
||||||
|
val responseBody = it.body?.string().orEmpty()
|
||||||
|
return json.decodeFromString(responseBody)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class HttpException(val code: Int) : IllegalStateException("HTTP error $code")
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package eu.kanade.tachiyomi.network
|
||||||
|
|
||||||
|
import okhttp3.MediaType
|
||||||
|
import okhttp3.ResponseBody
|
||||||
|
import okio.Buffer
|
||||||
|
import okio.BufferedSource
|
||||||
|
import okio.ForwardingSource
|
||||||
|
import okio.Source
|
||||||
|
import okio.buffer
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
|
class ProgressResponseBody(private val responseBody: ResponseBody, private val progressListener: ProgressListener) : ResponseBody() {
|
||||||
|
|
||||||
|
private val bufferedSource: BufferedSource by lazy {
|
||||||
|
source(responseBody.source()).buffer()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun contentType(): MediaType? {
|
||||||
|
return responseBody.contentType()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun contentLength(): Long {
|
||||||
|
return responseBody.contentLength()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun source(): BufferedSource {
|
||||||
|
return bufferedSource
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun source(source: Source): Source {
|
||||||
|
return object : ForwardingSource(source) {
|
||||||
|
var totalBytesRead = 0L
|
||||||
|
|
||||||
|
@Throws(IOException::class)
|
||||||
|
override fun read(sink: Buffer, byteCount: Long): Long {
|
||||||
|
val bytesRead = super.read(sink, byteCount)
|
||||||
|
// read() returns the number of bytes read, or -1 if this source is exhausted.
|
||||||
|
totalBytesRead += if (bytesRead != -1L) bytesRead else 0
|
||||||
|
progressListener.update(totalBytesRead, responseBody.contentLength(), bytesRead == -1L)
|
||||||
|
return bytesRead
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.network
|
|||||||
import okhttp3.CacheControl
|
import okhttp3.CacheControl
|
||||||
import okhttp3.FormBody
|
import okhttp3.FormBody
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
|
import okhttp3.HttpUrl
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.RequestBody
|
import okhttp3.RequestBody
|
||||||
import java.util.concurrent.TimeUnit.MINUTES
|
import java.util.concurrent.TimeUnit.MINUTES
|
||||||
@@ -23,6 +24,21 @@ fun GET(
|
|||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since extensions-lib 1.4
|
||||||
|
*/
|
||||||
|
fun GET(
|
||||||
|
url: HttpUrl,
|
||||||
|
headers: Headers = DEFAULT_HEADERS,
|
||||||
|
cache: CacheControl = DEFAULT_CACHE_CONTROL
|
||||||
|
): Request {
|
||||||
|
return Request.Builder()
|
||||||
|
.url(url)
|
||||||
|
.headers(headers)
|
||||||
|
.cacheControl(cache)
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
|
||||||
fun POST(
|
fun POST(
|
||||||
url: String,
|
url: String,
|
||||||
headers: Headers = DEFAULT_HEADERS,
|
headers: Headers = DEFAULT_HEADERS,
|
||||||
|
|||||||
+167
-46
@@ -1,19 +1,25 @@
|
|||||||
package eu.kanade.tachiyomi.network.interceptor
|
package eu.kanade.tachiyomi.network.interceptor
|
||||||
|
|
||||||
import com.gargoylesoftware.htmlunit.BrowserVersion
|
import com.microsoft.playwright.Browser
|
||||||
import com.gargoylesoftware.htmlunit.WebClient
|
import com.microsoft.playwright.BrowserType.LaunchOptions
|
||||||
import com.gargoylesoftware.htmlunit.html.HtmlPage
|
import com.microsoft.playwright.Page
|
||||||
|
import com.microsoft.playwright.Playwright
|
||||||
|
import com.microsoft.playwright.PlaywrightException
|
||||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||||
|
import eu.kanade.tachiyomi.network.interceptor.CFClearance.resolveWithWebView
|
||||||
import mu.KotlinLogging
|
import mu.KotlinLogging
|
||||||
import okhttp3.Cookie
|
import okhttp3.Cookie
|
||||||
import okhttp3.HttpUrl
|
import okhttp3.HttpUrl
|
||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
|
import suwayomi.tachidesk.server.ServerConfig
|
||||||
|
import suwayomi.tachidesk.server.serverConfig
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
import kotlin.time.Duration.Companion.seconds
|
||||||
|
import kotlin.time.DurationUnit
|
||||||
|
|
||||||
// from TachiWeb-Server
|
|
||||||
class CloudflareInterceptor : Interceptor {
|
class CloudflareInterceptor : Interceptor {
|
||||||
private val logger = KotlinLogging.logger {}
|
private val logger = KotlinLogging.logger {}
|
||||||
|
|
||||||
@@ -25,20 +31,24 @@ class CloudflareInterceptor : Interceptor {
|
|||||||
|
|
||||||
logger.trace { "CloudflareInterceptor is being used." }
|
logger.trace { "CloudflareInterceptor is being used." }
|
||||||
|
|
||||||
val response = chain.proceed(originalRequest)
|
val originalResponse = chain.proceed(chain.request())
|
||||||
|
|
||||||
// Check if Cloudflare anti-bot is on
|
// Check if Cloudflare anti-bot is on
|
||||||
if (response.code != 503 || response.header("Server") !in SERVER_CHECK) {
|
if (!(originalResponse.code in ERROR_CODES && originalResponse.header("Server") in SERVER_CHECK)) {
|
||||||
return response
|
return originalResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw IOException("playwrite is diabled for v0.6.7")
|
||||||
|
|
||||||
logger.debug { "Cloudflare anti-bot is on, CloudflareInterceptor is kicking in..." }
|
logger.debug { "Cloudflare anti-bot is on, CloudflareInterceptor is kicking in..." }
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
response.close()
|
originalResponse.close()
|
||||||
network.cookies.remove(originalRequest.url.toUri())
|
network.cookies.remove(originalRequest.url.toUri())
|
||||||
|
|
||||||
chain.proceed(resolveChallenge(response))
|
val request = resolveWithWebView(originalRequest)
|
||||||
|
|
||||||
|
chain.proceed(request)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
// Because OkHttp's enqueue only handles IOExceptions, wrap the exception so that
|
// Because OkHttp's enqueue only handles IOExceptions, wrap the exception so that
|
||||||
// we don't crash the entire app
|
// we don't crash the entire app
|
||||||
@@ -46,65 +56,176 @@ class CloudflareInterceptor : Interceptor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun resolveChallenge(response: Response): Request {
|
companion object {
|
||||||
val browserVersion = BrowserVersion.BrowserVersionBuilder(BrowserVersion.BEST_SUPPORTED)
|
private val ERROR_CODES = listOf(403, 503)
|
||||||
.setUserAgent(response.request.header("User-Agent") ?: BrowserVersion.BEST_SUPPORTED.userAgent)
|
private val SERVER_CHECK = arrayOf("cloudflare-nginx", "cloudflare")
|
||||||
.build()
|
private val COOKIE_NAMES = listOf("cf_clearance")
|
||||||
val convertedCookies = WebClient(browserVersion).use { webClient ->
|
}
|
||||||
webClient.options.isThrowExceptionOnFailingStatusCode = false
|
}
|
||||||
webClient.options.isThrowExceptionOnScriptError = false
|
|
||||||
webClient.getPage<HtmlPage>(response.request.url.toString())
|
/*
|
||||||
webClient.waitForBackgroundJavaScript(10000)
|
* This class is ported from https://github.com/vvanglro/cf-clearance
|
||||||
// Challenge solved, process cookies
|
* The original code is licensed under Apache 2.0
|
||||||
webClient.cookieManager.cookies.filter {
|
*/
|
||||||
// Only include Cloudflare cookies
|
object CFClearance {
|
||||||
it.name.startsWith("__cf") || it.name.startsWith("cf_")
|
private val logger = KotlinLogging.logger {}
|
||||||
}.map {
|
private val network: NetworkHelper by injectLazy()
|
||||||
// Convert cookies -> OkHttp format
|
|
||||||
Cookie.Builder()
|
init {
|
||||||
.domain(it.domain.removePrefix("."))
|
// Fix the default DriverJar issue by providing our own implementation
|
||||||
.expiresAt(it.expires?.time ?: Long.MAX_VALUE)
|
// ref: https://github.com/microsoft/playwright-java/issues/1138
|
||||||
.name(it.name)
|
System.setProperty("playwright.driver.impl", "suwayomi.tachidesk.server.util.DriverJar")
|
||||||
.path(it.path)
|
}
|
||||||
.value(it.value).apply {
|
|
||||||
if (it.isHttpOnly) httpOnly()
|
fun resolveWithWebView(originalRequest: Request): Request {
|
||||||
if (it.isSecure) secure()
|
val url = originalRequest.url.toString()
|
||||||
}.build()
|
|
||||||
|
logger.debug { "resolveWithWebView($url)" }
|
||||||
|
|
||||||
|
val cookies = Playwright.create().use { playwright ->
|
||||||
|
playwright.chromium().launch(
|
||||||
|
LaunchOptions()
|
||||||
|
.setHeadless(false)
|
||||||
|
.apply {
|
||||||
|
if (serverConfig.socksProxyEnabled) {
|
||||||
|
setProxy("socks5://${serverConfig.socksProxyHost}:${serverConfig.socksProxyPort}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).use { browser ->
|
||||||
|
val userAgent = originalRequest.header("User-Agent")
|
||||||
|
if (userAgent != null) {
|
||||||
|
browser.newContext(Browser.NewContextOptions().setUserAgent(userAgent)).use { browserContext ->
|
||||||
|
browserContext.newPage().use { getCookies(it, url) }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
browser.newPage().use { getCookies(it, url) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy cookies to cookie store
|
// Copy cookies to cookie store
|
||||||
convertedCookies.forEach {
|
cookies.groupBy { it.domain }.forEach { (domain, cookies) ->
|
||||||
network.cookies.addAll(
|
network.cookies.addAll(
|
||||||
HttpUrl.Builder()
|
url = HttpUrl.Builder()
|
||||||
.scheme("http")
|
.scheme("http")
|
||||||
.host(it.domain)
|
.host(domain)
|
||||||
.build(),
|
.build(),
|
||||||
listOf(it)
|
cookies = cookies
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// Merge new and existing cookies for this request
|
// Merge new and existing cookies for this request
|
||||||
// Find the cookies that we need to merge into this request
|
// Find the cookies that we need to merge into this request
|
||||||
val convertedForThisRequest = convertedCookies.filter {
|
val convertedForThisRequest = cookies.filter {
|
||||||
it.matches(response.request.url)
|
it.matches(originalRequest.url)
|
||||||
}
|
}
|
||||||
// Extract cookies from current request
|
// Extract cookies from current request
|
||||||
val existingCookies = Cookie.parseAll(
|
val existingCookies = Cookie.parseAll(
|
||||||
response.request.url,
|
originalRequest.url,
|
||||||
response.request.headers
|
originalRequest.headers
|
||||||
)
|
)
|
||||||
// Filter out existing values of cookies that we are about to merge in
|
// Filter out existing values of cookies that we are about to merge in
|
||||||
val filteredExisting = existingCookies.filter { existing ->
|
val filteredExisting = existingCookies.filter { existing ->
|
||||||
convertedForThisRequest.none { converted -> converted.name == existing.name }
|
convertedForThisRequest.none { converted -> converted.name == existing.name }
|
||||||
}
|
}
|
||||||
|
logger.trace { "Existing cookies" }
|
||||||
|
logger.trace { existingCookies.joinToString("; ") }
|
||||||
val newCookies = filteredExisting + convertedForThisRequest
|
val newCookies = filteredExisting + convertedForThisRequest
|
||||||
return response.request.newBuilder()
|
logger.trace { "New cookies" }
|
||||||
.header("Cookie", newCookies.map { it.toString() }.joinToString("; "))
|
logger.trace { newCookies.joinToString("; ") }
|
||||||
|
return originalRequest.newBuilder()
|
||||||
|
.header("Cookie", newCookies.joinToString("; ") { "${it.name}=${it.value}" })
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
fun getWebViewUserAgent(): String {
|
||||||
private val SERVER_CHECK = arrayOf("cloudflare-nginx", "cloudflare")
|
return try {
|
||||||
private val COOKIE_NAMES = listOf("cf_clearance")
|
throw PlaywrightException("playwrite is diabled for v0.6.7")
|
||||||
|
|
||||||
|
Playwright.create().use { playwright ->
|
||||||
|
playwright.chromium().launch(
|
||||||
|
LaunchOptions()
|
||||||
|
.setHeadless(true)
|
||||||
|
).use { browser ->
|
||||||
|
browser.newPage().use { page ->
|
||||||
|
val userAgent = page.evaluate("() => {return navigator.userAgent}") as String
|
||||||
|
logger.debug { "WebView User-Agent is $userAgent" }
|
||||||
|
return userAgent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e: PlaywrightException) {
|
||||||
|
// Playwright might fail on headless environments like docker
|
||||||
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getCookies(page: Page, url: String): List<Cookie> {
|
||||||
|
applyStealthInitScripts(page)
|
||||||
|
page.navigate(url)
|
||||||
|
val challengeResolved = waitForChallengeResolve(page)
|
||||||
|
|
||||||
|
return if (challengeResolved) {
|
||||||
|
val cookies = page.context().cookies()
|
||||||
|
|
||||||
|
logger.debug {
|
||||||
|
val userAgent = page.evaluate("() => {return navigator.userAgent}")
|
||||||
|
"Playwright User-Agent is $userAgent"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert PlayWright cookies to OkHttp cookies
|
||||||
|
cookies.map {
|
||||||
|
Cookie.Builder()
|
||||||
|
.domain(it.domain.removePrefix("."))
|
||||||
|
.expiresAt(it.expires?.times(1000)?.toLong() ?: Long.MAX_VALUE)
|
||||||
|
.name(it.name)
|
||||||
|
.path(it.path)
|
||||||
|
.value(it.value).apply {
|
||||||
|
if (it.httpOnly) httpOnly()
|
||||||
|
if (it.secure) secure()
|
||||||
|
}.build()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.debug { "Cloudflare challenge failed to resolve" }
|
||||||
|
throw CloudflareBypassException()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ref: https://github.com/vvanglro/cf-clearance/blob/44124a8f06d8d0ecf2bf558a027082ff88dab435/cf_clearance/stealth.py#L18
|
||||||
|
private val stealthInitScripts by lazy {
|
||||||
|
arrayOf(
|
||||||
|
ServerConfig::class.java.getResource("/cloudflare-js/canvas.fingerprinting.js")!!.readText(),
|
||||||
|
ServerConfig::class.java.getResource("/cloudflare-js/chrome.global.js")!!.readText(),
|
||||||
|
ServerConfig::class.java.getResource("/cloudflare-js/emulate.touch.js")!!.readText(),
|
||||||
|
ServerConfig::class.java.getResource("/cloudflare-js/navigator.permissions.js")!!.readText(),
|
||||||
|
ServerConfig::class.java.getResource("/cloudflare-js/navigator.webdriver.js")!!.readText(),
|
||||||
|
ServerConfig::class.java.getResource("/cloudflare-js/chrome.runtime.js")!!.readText(),
|
||||||
|
ServerConfig::class.java.getResource("/cloudflare-js/chrome.plugin.js")!!.readText()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ref: https://github.com/vvanglro/cf-clearance/blob/44124a8f06d8d0ecf2bf558a027082ff88dab435/cf_clearance/stealth.py#L76
|
||||||
|
private fun applyStealthInitScripts(page: Page) {
|
||||||
|
for (script in stealthInitScripts) {
|
||||||
|
page.addInitScript(script)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ref: https://github.com/vvanglro/cf-clearance/blob/44124a8f06d8d0ecf2bf558a027082ff88dab435/cf_clearance/retry.py#L21
|
||||||
|
private fun waitForChallengeResolve(page: Page): Boolean {
|
||||||
|
// sometimes the user has to solve the captcha challenge manually, potentially wait a long time
|
||||||
|
val timeoutSeconds = 120
|
||||||
|
repeat(timeoutSeconds) {
|
||||||
|
page.waitForTimeout(1.seconds.toDouble(DurationUnit.MILLISECONDS))
|
||||||
|
val success = try {
|
||||||
|
page.querySelector("#challenge-form") == null
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logger.debug(e) { "query Error" }
|
||||||
|
false
|
||||||
|
}
|
||||||
|
if (success) return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
private class CloudflareBypassException : Exception()
|
||||||
}
|
}
|
||||||
|
|||||||
+67
@@ -0,0 +1,67 @@
|
|||||||
|
package eu.kanade.tachiyomi.network.interceptor
|
||||||
|
|
||||||
|
import android.os.SystemClock
|
||||||
|
import okhttp3.Interceptor
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Response
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An OkHttp interceptor that handles rate limiting.
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
*
|
||||||
|
* permits = 5, period = 1, unit = seconds => 5 requests per second
|
||||||
|
* permits = 10, period = 2, unit = minutes => 10 requests per 2 minutes
|
||||||
|
*
|
||||||
|
* @since extension-lib 1.3
|
||||||
|
*
|
||||||
|
* @param permits {Int} Number of requests allowed within a period of units.
|
||||||
|
* @param period {Long} The limiting duration. Defaults to 1.
|
||||||
|
* @param unit {TimeUnit} The unit of time for the period. Defaults to seconds.
|
||||||
|
*/
|
||||||
|
fun OkHttpClient.Builder.rateLimit(
|
||||||
|
permits: Int,
|
||||||
|
period: Long = 1,
|
||||||
|
unit: TimeUnit = TimeUnit.SECONDS
|
||||||
|
) = addInterceptor(RateLimitInterceptor(permits, period, unit))
|
||||||
|
|
||||||
|
private class RateLimitInterceptor(
|
||||||
|
private val permits: Int,
|
||||||
|
period: Long,
|
||||||
|
unit: TimeUnit
|
||||||
|
) : Interceptor {
|
||||||
|
|
||||||
|
private val requestQueue = ArrayList<Long>(permits)
|
||||||
|
private val rateLimitMillis = unit.toMillis(period)
|
||||||
|
|
||||||
|
override fun intercept(chain: Interceptor.Chain): Response {
|
||||||
|
synchronized(requestQueue) {
|
||||||
|
val now = SystemClock.elapsedRealtime()
|
||||||
|
val waitTime = if (requestQueue.size < permits) {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
val oldestReq = requestQueue[0]
|
||||||
|
val newestReq = requestQueue[permits - 1]
|
||||||
|
|
||||||
|
if (newestReq - oldestReq > rateLimitMillis) {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
oldestReq + rateLimitMillis - now // Remaining time
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (requestQueue.size == permits) {
|
||||||
|
requestQueue.removeAt(0)
|
||||||
|
}
|
||||||
|
if (waitTime > 0) {
|
||||||
|
requestQueue.add(now + waitTime)
|
||||||
|
Thread.sleep(waitTime) // Sleep inside synchronized to pause queued requests
|
||||||
|
} else {
|
||||||
|
requestQueue.add(now)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return chain.proceed(chain.request())
|
||||||
|
}
|
||||||
|
}
|
||||||
+75
@@ -0,0 +1,75 @@
|
|||||||
|
package eu.kanade.tachiyomi.network.interceptor
|
||||||
|
|
||||||
|
import android.os.SystemClock
|
||||||
|
import okhttp3.HttpUrl
|
||||||
|
import okhttp3.Interceptor
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Response
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An OkHttp interceptor that handles given url host's rate limiting.
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
*
|
||||||
|
* httpUrl = "api.manga.com".toHttpUrlOrNull(), permits = 5, period = 1, unit = seconds => 5 requests per second to api.manga.com
|
||||||
|
* httpUrl = "imagecdn.manga.com".toHttpUrlOrNull(), permits = 10, period = 2, unit = minutes => 10 requests per 2 minutes to imagecdn.manga.com
|
||||||
|
*
|
||||||
|
* @since extension-lib 1.3
|
||||||
|
*
|
||||||
|
* @param httpUrl {HttpUrl} The url host that this interceptor should handle. Will get url's host by using HttpUrl.host()
|
||||||
|
* @param permits {Int} Number of requests allowed within a period of units.
|
||||||
|
* @param period {Long} The limiting duration. Defaults to 1.
|
||||||
|
* @param unit {TimeUnit} The unit of time for the period. Defaults to seconds.
|
||||||
|
*/
|
||||||
|
fun OkHttpClient.Builder.rateLimitHost(
|
||||||
|
httpUrl: HttpUrl,
|
||||||
|
permits: Int,
|
||||||
|
period: Long = 1,
|
||||||
|
unit: TimeUnit = TimeUnit.SECONDS
|
||||||
|
) = addInterceptor(SpecificHostRateLimitInterceptor(httpUrl, permits, period, unit))
|
||||||
|
|
||||||
|
class SpecificHostRateLimitInterceptor(
|
||||||
|
httpUrl: HttpUrl,
|
||||||
|
private val permits: Int,
|
||||||
|
period: Long,
|
||||||
|
unit: TimeUnit
|
||||||
|
) : Interceptor {
|
||||||
|
|
||||||
|
private val requestQueue = ArrayList<Long>(permits)
|
||||||
|
private val rateLimitMillis = unit.toMillis(period)
|
||||||
|
private val host = httpUrl.host
|
||||||
|
|
||||||
|
override fun intercept(chain: Interceptor.Chain): Response {
|
||||||
|
if (chain.request().url.host != host) {
|
||||||
|
return chain.proceed(chain.request())
|
||||||
|
}
|
||||||
|
synchronized(requestQueue) {
|
||||||
|
val now = SystemClock.elapsedRealtime()
|
||||||
|
val waitTime = if (requestQueue.size < permits) {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
val oldestReq = requestQueue[0]
|
||||||
|
val newestReq = requestQueue[permits - 1]
|
||||||
|
|
||||||
|
if (newestReq - oldestReq > rateLimitMillis) {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
oldestReq + rateLimitMillis - now // Remaining time
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (requestQueue.size == permits) {
|
||||||
|
requestQueue.removeAt(0)
|
||||||
|
}
|
||||||
|
if (waitTime > 0) {
|
||||||
|
requestQueue.add(now + waitTime)
|
||||||
|
Thread.sleep(waitTime) // Sleep inside synchronized to pause queued requests
|
||||||
|
} else {
|
||||||
|
requestQueue.add(now)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return chain.proceed(chain.request())
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package eu.kanade.tachiyomi.source
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A source that explicitly doesn't require traffic considerations.
|
||||||
|
*
|
||||||
|
* This typically applies for self-hosted sources.
|
||||||
|
*/
|
||||||
|
interface UnmeteredSource
|
||||||
@@ -293,12 +293,15 @@ class LocalSource : CatalogueSource {
|
|||||||
return when (getFormat(chapterFile)) {
|
return when (getFormat(chapterFile)) {
|
||||||
is Directory -> {
|
is Directory -> {
|
||||||
Observable.just(
|
Observable.just(
|
||||||
chapterFile.listFiles().orEmpty().sortedBy { it.name }.mapIndexed { index, page ->
|
chapterFile.listFiles().orEmpty()
|
||||||
Page(
|
.sortedBy { it.name }
|
||||||
index,
|
.filter { !it.isDirectory && ImageUtil.isImage(it.name, it::inputStream) }
|
||||||
imageUrl = applicationDirs.localMangaRoot + "/" + chapter.url + "/" + page.name
|
.mapIndexed { index, page ->
|
||||||
)
|
Page(
|
||||||
}
|
index,
|
||||||
|
imageUrl = applicationDirs.localMangaRoot + "/" + chapter.url + "/" + page.name
|
||||||
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
is Zip -> {
|
is Zip -> {
|
||||||
@@ -324,8 +327,9 @@ class LocalSource : CatalogueSource {
|
|||||||
|
|
||||||
fun getFormat(chapter: SChapter): Format {
|
fun getFormat(chapter: SChapter): Format {
|
||||||
val chapFile = File(applicationDirs.localMangaRoot, chapter.url)
|
val chapFile = File(applicationDirs.localMangaRoot, chapter.url)
|
||||||
if (chapFile.exists())
|
if (chapFile.exists()) {
|
||||||
return getFormat(chapFile)
|
return getFormat(chapFile)
|
||||||
|
}
|
||||||
|
|
||||||
throw Exception("Chapter not found")
|
throw Exception("Chapter not found")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package eu.kanade.tachiyomi.source.local.loader
|
package eu.kanade.tachiyomi.source.local.loader
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
|
||||||
import eu.kanade.tachiyomi.util.storage.EpubFile
|
import eu.kanade.tachiyomi.util.storage.EpubFile
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@@ -24,7 +23,6 @@ class EpubPageLoader(file: File) : PageLoader {
|
|||||||
val streamFn = { epub.getInputStream(epub.getEntry(path)!!) }
|
val streamFn = { epub.getInputStream(epub.getEntry(path)!!) }
|
||||||
ReaderPage(i).apply {
|
ReaderPage(i).apply {
|
||||||
stream = streamFn
|
stream = streamFn
|
||||||
status = Page.READY
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,12 @@ package eu.kanade.tachiyomi.source.local.loader
|
|||||||
|
|
||||||
import com.github.junrar.Archive
|
import com.github.junrar.Archive
|
||||||
import com.github.junrar.rarfile.FileHeader
|
import com.github.junrar.rarfile.FileHeader
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
|
||||||
import eu.kanade.tachiyomi.util.lang.compareToCaseInsensitiveNaturalOrder
|
import eu.kanade.tachiyomi.util.lang.compareToCaseInsensitiveNaturalOrder
|
||||||
import suwayomi.tachidesk.manga.impl.util.storage.ImageUtil
|
import suwayomi.tachidesk.manga.impl.util.storage.ImageUtil
|
||||||
|
import java.io.ByteArrayInputStream
|
||||||
|
import java.io.ByteArrayOutputStream
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.io.PipedInputStream
|
|
||||||
import java.io.PipedOutputStream
|
|
||||||
import java.util.concurrent.Executors
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loader used to load a chapter from a .rar or .cbr file.
|
* Loader used to load a chapter from a .rar or .cbr file.
|
||||||
@@ -22,42 +20,43 @@ class RarPageLoader(file: File) : PageLoader {
|
|||||||
private val archive = Archive(file)
|
private val archive = Archive(file)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pool for copying compressed files to an input stream.
|
* The fully uncompressed files, to be used in case archive is solid.
|
||||||
*/
|
*/
|
||||||
private val pool = Executors.newFixedThreadPool(1)
|
private var archiveMap = mutableMapOf<FileHeader, InputStream>()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an observable containing the pages found on this rar archive ordered with a natural
|
* Returns an observable containing the pages found on this rar archive ordered with a natural
|
||||||
* comparator.
|
* comparator.
|
||||||
*/
|
*/
|
||||||
override fun getPages(): List<ReaderPage> {
|
override fun getPages(): List<ReaderPage> {
|
||||||
|
if (archive.mainHeader.isSolid) {
|
||||||
|
// Solid means that we need to read all the file sequentially
|
||||||
|
for (header in archive.fileHeaders) {
|
||||||
|
val baos = ByteArrayOutputStream()
|
||||||
|
archive.extractFile(header, baos)
|
||||||
|
archiveMap[header] = ByteArrayInputStream(baos.toByteArray())
|
||||||
|
}
|
||||||
|
// After reading the full archive, proceed to filter and transform
|
||||||
|
return archive.fileHeaders
|
||||||
|
.filter { !it.isDirectory && ImageUtil.isImage(it.fileName) { archiveMap.getValue(it) } }
|
||||||
|
.sortedWith { f1, f2 -> f1.fileName.compareToCaseInsensitiveNaturalOrder(f2.fileName) }
|
||||||
|
.mapIndexed { i, header ->
|
||||||
|
val streamFn = { archiveMap.getValue(header) }
|
||||||
|
|
||||||
|
ReaderPage(i).apply {
|
||||||
|
stream = streamFn
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return archive.fileHeaders
|
return archive.fileHeaders
|
||||||
.filter { !it.isDirectory && ImageUtil.isImage(it.fileName) { archive.getInputStream(it) } }
|
.filter { !it.isDirectory && ImageUtil.isImage(it.fileName) { archive.getInputStream(it) } }
|
||||||
.sortedWith { f1, f2 -> f1.fileName.compareToCaseInsensitiveNaturalOrder(f2.fileName) }
|
.sortedWith { f1, f2 -> f1.fileName.compareToCaseInsensitiveNaturalOrder(f2.fileName) }
|
||||||
.mapIndexed { i, header ->
|
.mapIndexed { i, header ->
|
||||||
val streamFn = { getStream(header) }
|
val streamFn = { archive.getInputStream(header) }
|
||||||
|
|
||||||
ReaderPage(i).apply {
|
ReaderPage(i).apply {
|
||||||
stream = streamFn
|
stream = streamFn
|
||||||
status = Page.READY
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an input stream for the given [header].
|
|
||||||
*/
|
|
||||||
private fun getStream(header: FileHeader): InputStream {
|
|
||||||
val pipeIn = PipedInputStream()
|
|
||||||
val pipeOut = PipedOutputStream(pipeIn)
|
|
||||||
pool.execute {
|
|
||||||
try {
|
|
||||||
pipeOut.use {
|
|
||||||
archive.extractFile(header, it)
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return pipeIn
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package eu.kanade.tachiyomi.source.local.loader
|
package eu.kanade.tachiyomi.source.local.loader
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
|
||||||
import eu.kanade.tachiyomi.util.lang.compareToCaseInsensitiveNaturalOrder
|
import eu.kanade.tachiyomi.util.lang.compareToCaseInsensitiveNaturalOrder
|
||||||
import suwayomi.tachidesk.manga.impl.util.storage.ImageUtil
|
import suwayomi.tachidesk.manga.impl.util.storage.ImageUtil
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -24,7 +23,6 @@ class ZipPageLoader(file: File) : PageLoader {
|
|||||||
val streamFn = { zip.getInputStream(entry) }
|
val streamFn = { zip.getInputStream(entry) }
|
||||||
ReaderPage(i).apply {
|
ReaderPage(i).apply {
|
||||||
stream = streamFn
|
stream = streamFn
|
||||||
status = Page.READY
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ package eu.kanade.tachiyomi.source.model
|
|||||||
open class Filter<T>(val name: String, var state: T) {
|
open class Filter<T>(val name: String, var state: T) {
|
||||||
open class Header(name: String) : Filter<Any>(name, 0)
|
open class Header(name: String) : Filter<Any>(name, 0)
|
||||||
open class Separator(name: String = "") : Filter<Any>(name, 0)
|
open class Separator(name: String = "") : Filter<Any>(name, 0)
|
||||||
abstract class Select<V>(name: String, val values: Array<V>, state: Int = 0) : Filter<Int>(name, state)
|
abstract class Select<V>(name: String, val values: Array<V>, state: Int = 0) : Filter<Int>(name, state) {
|
||||||
|
val displayValues get() = values.map { it.toString() }
|
||||||
|
}
|
||||||
abstract class Text(name: String, state: String = "") : Filter<String>(name, state)
|
abstract class Text(name: String, state: String = "") : Filter<String>(name, state)
|
||||||
abstract class CheckBox(name: String, state: Boolean = false) : Filter<Boolean>(name, state)
|
abstract class CheckBox(name: String, state: Boolean = false) : Filter<Boolean>(name, state)
|
||||||
abstract class TriState(name: String, state: Int = STATE_IGNORE) : Filter<Int>(name, state) {
|
abstract class TriState(name: String, state: Int = STATE_IGNORE) : Filter<Int>(name, state) {
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ package eu.kanade.tachiyomi.source.model
|
|||||||
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import eu.kanade.tachiyomi.network.ProgressListener
|
import eu.kanade.tachiyomi.network.ProgressListener
|
||||||
import rx.subjects.Subject
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
|
|
||||||
open class Page(
|
open class Page(
|
||||||
val index: Int,
|
val index: Int,
|
||||||
@@ -11,48 +12,17 @@ open class Page(
|
|||||||
@Transient var uri: Uri? = null // Deprecated but can't be deleted due to extensions
|
@Transient var uri: Uri? = null // Deprecated but can't be deleted due to extensions
|
||||||
) : ProgressListener {
|
) : ProgressListener {
|
||||||
|
|
||||||
val number: Int
|
private val _progress = MutableStateFlow(0)
|
||||||
get() = index + 1
|
val progress = _progress.asStateFlow()
|
||||||
|
|
||||||
@Transient
|
|
||||||
@Volatile
|
|
||||||
var status: Int = 0
|
|
||||||
set(value) {
|
|
||||||
field = value
|
|
||||||
statusSubject?.onNext(value)
|
|
||||||
statusCallback?.invoke(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transient
|
|
||||||
@Volatile
|
|
||||||
var progress: Int = 0
|
|
||||||
set(value) {
|
|
||||||
field = value
|
|
||||||
statusCallback?.invoke(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transient
|
|
||||||
private var statusSubject: Subject<Int, Int>? = null
|
|
||||||
|
|
||||||
@Transient
|
|
||||||
private var statusCallback: ((Page) -> Unit)? = null
|
|
||||||
|
|
||||||
override fun update(bytesRead: Long, contentLength: Long, done: Boolean) {
|
override fun update(bytesRead: Long, contentLength: Long, done: Boolean) {
|
||||||
progress = if (contentLength > 0) {
|
_progress.value = if (contentLength > 0) {
|
||||||
(100 * bytesRead / contentLength).toInt()
|
(100 * bytesRead / contentLength).toInt()
|
||||||
} else {
|
} else {
|
||||||
-1
|
-1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setStatusSubject(subject: Subject<Int, Int>?) {
|
|
||||||
this.statusSubject = subject
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setStatusCallback(f: ((Page) -> Unit)?) {
|
|
||||||
statusCallback = f
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val QUEUE = 0
|
const val QUEUE = 0
|
||||||
const val LOAD_PAGE = 1
|
const val LOAD_PAGE = 1
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ interface SManga : Serializable {
|
|||||||
|
|
||||||
var thumbnail_url: String?
|
var thumbnail_url: String?
|
||||||
|
|
||||||
|
var update_strategy: UpdateStrategy
|
||||||
|
|
||||||
var initialized: Boolean
|
var initialized: Boolean
|
||||||
|
|
||||||
fun copyFrom(other: SManga) {
|
fun copyFrom(other: SManga) {
|
||||||
@@ -55,6 +57,9 @@ interface SManga : Serializable {
|
|||||||
const val ONGOING = 1
|
const val ONGOING = 1
|
||||||
const val COMPLETED = 2
|
const val COMPLETED = 2
|
||||||
const val LICENSED = 3
|
const val LICENSED = 3
|
||||||
|
const val PUBLISHING_FINISHED = 4
|
||||||
|
const val CANCELLED = 5
|
||||||
|
const val ON_HIATUS = 6
|
||||||
|
|
||||||
fun create(): SManga {
|
fun create(): SManga {
|
||||||
return SMangaImpl()
|
return SMangaImpl()
|
||||||
|
|||||||
@@ -18,5 +18,7 @@ class SMangaImpl : SManga {
|
|||||||
|
|
||||||
override var thumbnail_url: String? = null
|
override var thumbnail_url: String? = null
|
||||||
|
|
||||||
|
override var update_strategy: UpdateStrategy = UpdateStrategy.ALWAYS_UPDATE
|
||||||
|
|
||||||
override var initialized: Boolean = false
|
override var initialized: Boolean = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package eu.kanade.tachiyomi.source.model
|
||||||
|
|
||||||
|
enum class UpdateStrategy {
|
||||||
|
ALWAYS_UPDATE,
|
||||||
|
ONLY_FETCH_ONCE
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.source.online
|
|||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||||
|
import eu.kanade.tachiyomi.network.interceptor.CFClearance.getWebViewUserAgent
|
||||||
import eu.kanade.tachiyomi.network.newCallWithProgress
|
import eu.kanade.tachiyomi.network.newCallWithProgress
|
||||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
@@ -356,6 +357,28 @@ abstract class HttpSource : CatalogueSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the url of the provided manga
|
||||||
|
*
|
||||||
|
* @since extensions-lib 1.4
|
||||||
|
* @param manga the manga
|
||||||
|
* @return url of the manga
|
||||||
|
*/
|
||||||
|
open fun getMangaUrl(manga: SManga): String {
|
||||||
|
return mangaDetailsRequest(manga).url.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the url of the provided chapter
|
||||||
|
*
|
||||||
|
* @since extensions-lib 1.4
|
||||||
|
* @param chapter the chapter
|
||||||
|
* @return url of the chapter
|
||||||
|
*/
|
||||||
|
open fun getChapterUrl(chapter: SChapter): String {
|
||||||
|
return pageListRequest(chapter).url.toString()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called before inserting a new chapter into database. Use it if you need to override chapter
|
* Called before inserting a new chapter into database. Use it if you need to override chapter
|
||||||
* fields, like the title or the chapter number. Do not change anything to [manga].
|
* fields, like the title or the chapter number. Do not change anything to [manga].
|
||||||
@@ -363,8 +386,7 @@ abstract class HttpSource : CatalogueSource {
|
|||||||
* @param chapter the chapter to be added.
|
* @param chapter the chapter to be added.
|
||||||
* @param manga the manga of the chapter.
|
* @param manga the manga of the chapter.
|
||||||
*/
|
*/
|
||||||
open fun prepareNewChapter(chapter: SChapter, manga: SManga) {
|
open fun prepareNewChapter(chapter: SChapter, manga: SManga) {}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of filters for the source.
|
* Returns the list of filters for the source.
|
||||||
@@ -372,6 +394,6 @@ abstract class HttpSource : CatalogueSource {
|
|||||||
override fun getFilterList() = FilterList()
|
override fun getFilterList() = FilterList()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36 Edg/88.0.705.63"
|
val DEFAULT_USER_AGENT by lazy { getWebViewUserAgent() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ import eu.kanade.tachiyomi.source.model.Page
|
|||||||
import rx.Observable
|
import rx.Observable
|
||||||
|
|
||||||
fun HttpSource.getImageUrl(page: Page): Observable<Page> {
|
fun HttpSource.getImageUrl(page: Page): Observable<Page> {
|
||||||
page.status = Page.LOAD_PAGE
|
|
||||||
return fetchImageUrl(page)
|
return fetchImageUrl(page)
|
||||||
.doOnError { page.status = Page.ERROR }
|
|
||||||
.onErrorReturn { null }
|
.onErrorReturn { null }
|
||||||
.doOnNext { page.imageUrl = it }
|
.doOnNext { page.imageUrl = it }
|
||||||
.map { page }
|
.map { page }
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ class EpubFile(file: File) : Closeable {
|
|||||||
*/
|
*/
|
||||||
private fun getPagesFromDocument(document: Document): List<String> {
|
private fun getPagesFromDocument(document: Document): List<String> {
|
||||||
val pages = document.select("manifest > item")
|
val pages = document.select("manifest > item")
|
||||||
.filter { "application/xhtml+xml" == it.attr("media-type") }
|
.filter { element -> "application/xhtml+xml" == element.attr("media-type") }
|
||||||
.associateBy { it.attr("id") }
|
.associateBy { it.attr("id") }
|
||||||
|
|
||||||
val spine = document.select("spine > itemref").map { it.attr("idref") }
|
val spine = document.select("spine > itemref").map { it.attr("idref") }
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package suwayomi.tachidesk
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) Contributors to the Suwayomi project
|
* Copyright (C) Contributors to the Suwayomi project
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|||||||
@@ -8,14 +8,20 @@ package suwayomi.tachidesk.global
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import io.javalin.apibuilder.ApiBuilder.get
|
import io.javalin.apibuilder.ApiBuilder.get
|
||||||
|
import io.javalin.apibuilder.ApiBuilder.patch
|
||||||
import io.javalin.apibuilder.ApiBuilder.path
|
import io.javalin.apibuilder.ApiBuilder.path
|
||||||
|
import suwayomi.tachidesk.global.controller.GlobalMetaController
|
||||||
import suwayomi.tachidesk.global.controller.SettingsController
|
import suwayomi.tachidesk.global.controller.SettingsController
|
||||||
|
|
||||||
object GlobalAPI {
|
object GlobalAPI {
|
||||||
fun defineEndpoints() {
|
fun defineEndpoints() {
|
||||||
|
path("meta") {
|
||||||
|
get("", GlobalMetaController.getMeta)
|
||||||
|
patch("", GlobalMetaController.modifyMeta)
|
||||||
|
}
|
||||||
path("settings") {
|
path("settings") {
|
||||||
get("about", SettingsController::about)
|
get("about", SettingsController.about)
|
||||||
get("check-update", SettingsController::checkUpdate)
|
get("check-update", SettingsController.checkUpdate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package suwayomi.tachidesk.global.controller
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) Contributors to the Suwayomi project
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
import io.javalin.http.HttpCode
|
||||||
|
import suwayomi.tachidesk.global.impl.GlobalMeta
|
||||||
|
import suwayomi.tachidesk.server.util.formParam
|
||||||
|
import suwayomi.tachidesk.server.util.handler
|
||||||
|
import suwayomi.tachidesk.server.util.withOperation
|
||||||
|
|
||||||
|
object GlobalMetaController {
|
||||||
|
/** used to modify a category's meta parameters */
|
||||||
|
val getMeta = handler(
|
||||||
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
|
summary("Server level meta mapping")
|
||||||
|
description("Get a list of globally stored key-value mapping, you can set values for whatever you want inside it.")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx ->
|
||||||
|
ctx.json(GlobalMeta.getMetaMap())
|
||||||
|
ctx.status(200)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
/** used to modify global meta parameters */
|
||||||
|
val modifyMeta = handler(
|
||||||
|
formParam<String>("key"),
|
||||||
|
formParam<String>("value"),
|
||||||
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
|
summary("Add meta data to the global meta mapping")
|
||||||
|
description("A simple Key-Value stored at server global level, you can set values for whatever you want inside it.")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, key, value ->
|
||||||
|
GlobalMeta.modifyMeta(key, value)
|
||||||
|
ctx.status(200)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -7,22 +7,48 @@ package suwayomi.tachidesk.global.controller
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import io.javalin.http.Context
|
import io.javalin.http.HttpCode
|
||||||
import suwayomi.tachidesk.global.impl.About
|
import suwayomi.tachidesk.global.impl.About
|
||||||
|
import suwayomi.tachidesk.global.impl.AboutDataClass
|
||||||
import suwayomi.tachidesk.global.impl.AppUpdate
|
import suwayomi.tachidesk.global.impl.AppUpdate
|
||||||
|
import suwayomi.tachidesk.global.impl.UpdateDataClass
|
||||||
import suwayomi.tachidesk.server.JavalinSetup.future
|
import suwayomi.tachidesk.server.JavalinSetup.future
|
||||||
|
import suwayomi.tachidesk.server.util.handler
|
||||||
|
import suwayomi.tachidesk.server.util.withOperation
|
||||||
|
|
||||||
/** Settings Page/Screen */
|
/** Settings Page/Screen */
|
||||||
object SettingsController {
|
object SettingsController {
|
||||||
/** returns some static info about the current app build */
|
/** returns some static info about the current app build */
|
||||||
fun about(ctx: Context) {
|
val about = handler(
|
||||||
ctx.json(About.getAbout())
|
documentWith = {
|
||||||
}
|
withOperation {
|
||||||
|
summary("About Tachidesk")
|
||||||
|
description("Returns some static info about the current app build")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx ->
|
||||||
|
ctx.json(About.getAbout())
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
json<AboutDataClass>(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** check for app updates */
|
/** check for app updates */
|
||||||
fun checkUpdate(ctx: Context) {
|
val checkUpdate = handler(
|
||||||
ctx.json(
|
documentWith = {
|
||||||
future { AppUpdate.checkUpdate() }
|
withOperation {
|
||||||
)
|
summary("Tachidesk update check")
|
||||||
}
|
description("Check for app updates")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx ->
|
||||||
|
ctx.future(
|
||||||
|
future { AppUpdate.checkUpdate() }
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
json<Array<UpdateDataClass>>(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ data class AboutDataClass(
|
|||||||
val buildType: String,
|
val buildType: String,
|
||||||
val buildTime: Long,
|
val buildTime: Long,
|
||||||
val github: String,
|
val github: String,
|
||||||
val discord: String,
|
val discord: String
|
||||||
)
|
)
|
||||||
|
|
||||||
object About {
|
object About {
|
||||||
@@ -28,7 +28,7 @@ object About {
|
|||||||
BuildConfig.BUILD_TYPE,
|
BuildConfig.BUILD_TYPE,
|
||||||
BuildConfig.BUILD_TIME,
|
BuildConfig.BUILD_TIME,
|
||||||
BuildConfig.GITHUB,
|
BuildConfig.GITHUB,
|
||||||
BuildConfig.DISCORD,
|
BuildConfig.DISCORD
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import uy.kohesive.injekt.injectLazy
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) Contributors to the Suwayomi project
|
* Copyright (C) Contributors to the Suwayomi project
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
@@ -46,13 +46,13 @@ object AppUpdate {
|
|||||||
UpdateDataClass(
|
UpdateDataClass(
|
||||||
"Stable",
|
"Stable",
|
||||||
stableJson["tag_name"]!!.jsonPrimitive.content,
|
stableJson["tag_name"]!!.jsonPrimitive.content,
|
||||||
stableJson["html_url"]!!.jsonPrimitive.content,
|
stableJson["html_url"]!!.jsonPrimitive.content
|
||||||
),
|
),
|
||||||
UpdateDataClass(
|
UpdateDataClass(
|
||||||
"Preview",
|
"Preview",
|
||||||
previewJson["tag_name"]!!.jsonPrimitive.content,
|
previewJson["tag_name"]!!.jsonPrimitive.content,
|
||||||
previewJson["html_url"]!!.jsonPrimitive.content,
|
previewJson["html_url"]!!.jsonPrimitive.content
|
||||||
),
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package suwayomi.tachidesk.global.impl
|
||||||
|
|
||||||
|
import org.jetbrains.exposed.sql.insert
|
||||||
|
import org.jetbrains.exposed.sql.select
|
||||||
|
import org.jetbrains.exposed.sql.selectAll
|
||||||
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
|
import org.jetbrains.exposed.sql.update
|
||||||
|
import suwayomi.tachidesk.global.model.table.GlobalMetaTable
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) Contributors to the Suwayomi project
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
object GlobalMeta {
|
||||||
|
fun modifyMeta(key: String, value: String) {
|
||||||
|
transaction {
|
||||||
|
val meta = transaction {
|
||||||
|
GlobalMetaTable.select { GlobalMetaTable.key eq key }
|
||||||
|
}.firstOrNull()
|
||||||
|
|
||||||
|
if (meta == null) {
|
||||||
|
GlobalMetaTable.insert {
|
||||||
|
it[GlobalMetaTable.key] = key
|
||||||
|
it[GlobalMetaTable.value] = value
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
GlobalMetaTable.update({ GlobalMetaTable.key eq key }) {
|
||||||
|
it[GlobalMetaTable.value] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getMetaMap(): Map<String, String> {
|
||||||
|
return transaction {
|
||||||
|
GlobalMetaTable.selectAll()
|
||||||
|
.associate { it[GlobalMetaTable.key] to it[GlobalMetaTable.value] }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package suwayomi.tachidesk.global.model.table
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) Contributors to the Suwayomi project
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
import org.jetbrains.exposed.dao.id.IntIdTable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Metadata storage for clients, server/global level.
|
||||||
|
*/
|
||||||
|
object GlobalMetaTable : IntIdTable() {
|
||||||
|
val key = varchar("key", 256)
|
||||||
|
val value = varchar("value", 4096)
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ import io.javalin.apibuilder.ApiBuilder.get
|
|||||||
import io.javalin.apibuilder.ApiBuilder.patch
|
import io.javalin.apibuilder.ApiBuilder.patch
|
||||||
import io.javalin.apibuilder.ApiBuilder.path
|
import io.javalin.apibuilder.ApiBuilder.path
|
||||||
import io.javalin.apibuilder.ApiBuilder.post
|
import io.javalin.apibuilder.ApiBuilder.post
|
||||||
|
import io.javalin.apibuilder.ApiBuilder.put
|
||||||
import io.javalin.apibuilder.ApiBuilder.ws
|
import io.javalin.apibuilder.ApiBuilder.ws
|
||||||
import suwayomi.tachidesk.manga.controller.BackupController
|
import suwayomi.tachidesk.manga.controller.BackupController
|
||||||
import suwayomi.tachidesk.manga.controller.CategoryController
|
import suwayomi.tachidesk.manga.controller.CategoryController
|
||||||
@@ -24,97 +25,111 @@ import suwayomi.tachidesk.manga.controller.UpdateController
|
|||||||
object MangaAPI {
|
object MangaAPI {
|
||||||
fun defineEndpoints() {
|
fun defineEndpoints() {
|
||||||
path("extension") {
|
path("extension") {
|
||||||
get("list", ExtensionController::list)
|
get("list", ExtensionController.list)
|
||||||
|
|
||||||
get("install/{pkgName}", ExtensionController::install)
|
get("install/{pkgName}", ExtensionController.install)
|
||||||
post("install", ExtensionController::installFile)
|
post("install", ExtensionController.installFile)
|
||||||
get("update/{pkgName}", ExtensionController::update)
|
get("update/{pkgName}", ExtensionController.update)
|
||||||
get("uninstall/{pkgName}", ExtensionController::uninstall)
|
get("uninstall/{pkgName}", ExtensionController.uninstall)
|
||||||
|
|
||||||
get("icon/{apkName}", ExtensionController::icon)
|
get("icon/{apkName}", ExtensionController.icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
path("source") {
|
path("source") {
|
||||||
get("list", SourceController::list)
|
get("list", SourceController.list)
|
||||||
get("{sourceId}", SourceController::retrieve)
|
get("{sourceId}", SourceController.retrieve)
|
||||||
|
|
||||||
get("{sourceId}/popular/{pageNum}", SourceController::popular)
|
get("{sourceId}/popular/{pageNum}", SourceController.popular)
|
||||||
get("{sourceId}/latest/{pageNum}", SourceController::latest)
|
get("{sourceId}/latest/{pageNum}", SourceController.latest)
|
||||||
|
|
||||||
get("{sourceId}/preferences", SourceController::getPreferences)
|
get("{sourceId}/preferences", SourceController.getPreferences)
|
||||||
post("{sourceId}/preferences", SourceController::setPreference)
|
post("{sourceId}/preferences", SourceController.setPreference)
|
||||||
|
|
||||||
get("{sourceId}/filters", SourceController::getFilters)
|
get("{sourceId}/filters", SourceController.getFilters)
|
||||||
post("{sourceId}/filters", SourceController::setFilter)
|
post("{sourceId}/filters", SourceController.setFilters)
|
||||||
|
|
||||||
get("{sourceId}/search", SourceController::searchSingle)
|
get("{sourceId}/search", SourceController.searchSingle)
|
||||||
// get("all/search", SourceController::searchGlobal) // TODO
|
post("{sourceId}/quick-search", SourceController.quickSearchSingle)
|
||||||
|
// get("all/search", SourceController.searchGlobal) // TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
path("manga") {
|
path("manga") {
|
||||||
get("{mangaId}", MangaController.retrieve)
|
get("{mangaId}", MangaController.retrieve)
|
||||||
get("{mangaId}/thumbnail", MangaController::thumbnail)
|
get("{mangaId}/full", MangaController.retrieveFull)
|
||||||
|
get("{mangaId}/thumbnail", MangaController.thumbnail)
|
||||||
|
|
||||||
get("{mangaId}/category", MangaController::categoryList)
|
get("{mangaId}/category", MangaController.categoryList)
|
||||||
get("{mangaId}/category/{categoryId}", MangaController::addToCategory)
|
get("{mangaId}/category/{categoryId}", MangaController.addToCategory)
|
||||||
delete("{mangaId}/category/{categoryId}", MangaController::removeFromCategory)
|
delete("{mangaId}/category/{categoryId}", MangaController.removeFromCategory)
|
||||||
|
|
||||||
get("{mangaId}/library", MangaController::addToLibrary)
|
get("{mangaId}/library", MangaController.addToLibrary)
|
||||||
delete("{mangaId}/library", MangaController::removeFromLibrary)
|
delete("{mangaId}/library", MangaController.removeFromLibrary)
|
||||||
|
|
||||||
patch("{mangaId}/meta", MangaController::meta)
|
patch("{mangaId}/meta", MangaController.meta)
|
||||||
|
|
||||||
get("{mangaId}/chapters", MangaController::chapterList)
|
get("{mangaId}/chapters", MangaController.chapterList)
|
||||||
get("{mangaId}/chapter/{chapterIndex}", MangaController::chapterRetrieve)
|
post("{mangaId}/chapter/batch", MangaController.chapterBatch)
|
||||||
patch("{mangaId}/chapter/{chapterIndex}", MangaController::chapterModify)
|
get("{mangaId}/chapter/{chapterIndex}", MangaController.chapterRetrieve)
|
||||||
delete("{mangaId}/chapter/{chapterIndex}", MangaController::chapterDelete)
|
patch("{mangaId}/chapter/{chapterIndex}", MangaController.chapterModify)
|
||||||
|
put("{mangaId}/chapter/{chapterIndex}", MangaController.chapterModify)
|
||||||
|
delete("{mangaId}/chapter/{chapterIndex}", MangaController.chapterDelete)
|
||||||
|
|
||||||
patch("{mangaId}/chapter/{chapterIndex}/meta", MangaController::chapterMeta)
|
patch("{mangaId}/chapter/{chapterIndex}/meta", MangaController.chapterMeta)
|
||||||
|
|
||||||
get("{mangaId}/chapter/{chapterIndex}/page/{index}", MangaController::pageRetrieve)
|
get("{mangaId}/chapter/{chapterIndex}/page/{index}", MangaController.pageRetrieve)
|
||||||
|
}
|
||||||
|
|
||||||
|
path("chapter") {
|
||||||
|
post("batch", MangaController.anyChapterBatch)
|
||||||
}
|
}
|
||||||
|
|
||||||
path("category") {
|
path("category") {
|
||||||
get("", CategoryController::categoryList)
|
get("", CategoryController.categoryList)
|
||||||
post("", CategoryController::categoryCreate)
|
post("", CategoryController.categoryCreate)
|
||||||
|
|
||||||
// The order here is important {categoryId} needs to be applied last
|
// The order here is important {categoryId} needs to be applied last
|
||||||
// or throws a NumberFormatException
|
// or throws a NumberFormatException
|
||||||
patch("reorder", CategoryController::categoryReorder)
|
patch("reorder", CategoryController.categoryReorder)
|
||||||
|
|
||||||
get("{categoryId}", CategoryController::categoryMangas)
|
get("{categoryId}", CategoryController.categoryMangas)
|
||||||
patch("{categoryId}", CategoryController::categoryModify)
|
patch("{categoryId}", CategoryController.categoryModify)
|
||||||
delete("{categoryId}", CategoryController::categoryDelete)
|
delete("{categoryId}", CategoryController.categoryDelete)
|
||||||
|
|
||||||
|
patch("{categoryId}/meta", CategoryController.meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
path("backup") {
|
path("backup") {
|
||||||
post("import", BackupController::protobufImport)
|
post("import", BackupController.protobufImport)
|
||||||
post("import/file", BackupController::protobufImportFile)
|
post("import/file", BackupController.protobufImportFile)
|
||||||
|
|
||||||
post("validate", BackupController::protobufValidate)
|
post("validate", BackupController.protobufValidate)
|
||||||
post("validate/file", BackupController::protobufValidateFile)
|
post("validate/file", BackupController.protobufValidateFile)
|
||||||
|
|
||||||
get("export", BackupController::protobufExport)
|
get("export", BackupController.protobufExport)
|
||||||
get("export/file", BackupController::protobufExportFile)
|
get("export/file", BackupController.protobufExportFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
path("downloads") {
|
path("downloads") {
|
||||||
ws("", DownloadController::downloadsWS)
|
ws("", DownloadController::downloadsWS)
|
||||||
|
|
||||||
get("start", DownloadController::start)
|
get("start", DownloadController.start)
|
||||||
get("stop", DownloadController::stop)
|
get("stop", DownloadController.stop)
|
||||||
get("clear", DownloadController::stop)
|
get("clear", DownloadController.clear)
|
||||||
}
|
}
|
||||||
|
|
||||||
path("download") {
|
path("download") {
|
||||||
get("{mangaId}/chapter/{chapterIndex}", DownloadController::queueChapter)
|
get("{mangaId}/chapter/{chapterIndex}", DownloadController.queueChapter)
|
||||||
delete("{mangaId}/chapter/{chapterIndex}", DownloadController::unqueueChapter)
|
delete("{mangaId}/chapter/{chapterIndex}", DownloadController.unqueueChapter)
|
||||||
|
patch("{mangaId}/chapter/{chapterIndex}/reorder/{to}", DownloadController.reorderChapter)
|
||||||
|
post("batch", DownloadController.queueChapters)
|
||||||
|
delete("batch", DownloadController.unqueueChapters)
|
||||||
}
|
}
|
||||||
|
|
||||||
path("update") {
|
path("update") {
|
||||||
get("recentChapters/{pageNum}", UpdateController::recentChapters)
|
get("recentChapters/{pageNum}", UpdateController.recentChapters)
|
||||||
post("fetch", UpdateController::categoryUpdate)
|
post("fetch", UpdateController.categoryUpdate)
|
||||||
get("summary", UpdateController::updateSummary)
|
post("reset", UpdateController.reset)
|
||||||
|
get("summary", UpdateController.updateSummary)
|
||||||
ws("", UpdateController::categoryUpdateWS)
|
ws("", UpdateController::categoryUpdateWS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
package suwayomi.tachidesk.manga.controller
|
package suwayomi.tachidesk.manga.controller
|
||||||
|
|
||||||
import io.javalin.http.Context
|
import io.javalin.http.HttpCode
|
||||||
import suwayomi.tachidesk.manga.impl.backup.BackupFlags
|
import suwayomi.tachidesk.manga.impl.backup.BackupFlags
|
||||||
import suwayomi.tachidesk.manga.impl.backup.proto.ProtoBackupExport
|
import suwayomi.tachidesk.manga.impl.backup.proto.ProtoBackupExport
|
||||||
import suwayomi.tachidesk.manga.impl.backup.proto.ProtoBackupImport
|
import suwayomi.tachidesk.manga.impl.backup.proto.ProtoBackupImport
|
||||||
import suwayomi.tachidesk.manga.impl.backup.proto.ProtoBackupValidator
|
import suwayomi.tachidesk.manga.impl.backup.proto.ProtoBackupValidator
|
||||||
import suwayomi.tachidesk.server.JavalinSetup.future
|
import suwayomi.tachidesk.server.JavalinSetup.future
|
||||||
|
import suwayomi.tachidesk.server.util.handler
|
||||||
|
import suwayomi.tachidesk.server.util.withOperation
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) Contributors to the Suwayomi project
|
* Copyright (C) Contributors to the Suwayomi project
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
@@ -19,78 +21,153 @@ import java.util.Date
|
|||||||
object BackupController {
|
object BackupController {
|
||||||
|
|
||||||
/** expects a Tachiyomi protobuf backup in the body */
|
/** expects a Tachiyomi protobuf backup in the body */
|
||||||
fun protobufImport(ctx: Context) {
|
val protobufImport = handler(
|
||||||
ctx.future(
|
documentWith = {
|
||||||
future {
|
withOperation {
|
||||||
ProtoBackupImport.performRestore(ctx.bodyAsInputStream())
|
summary("Restore a backup")
|
||||||
|
description("Expects a Tachiyomi protobuf backup in the body")
|
||||||
}
|
}
|
||||||
)
|
},
|
||||||
}
|
behaviorOf = { ctx ->
|
||||||
|
ctx.future(
|
||||||
|
future {
|
||||||
|
ProtoBackupImport.performRestore(ctx.bodyAsInputStream())
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** expects a Tachiyomi protobuf backup as a file upload, the file must be named "backup.proto.gz" */
|
/** expects a Tachiyomi protobuf backup as a file upload, the file must be named "backup.proto.gz" */
|
||||||
fun protobufImportFile(ctx: Context) {
|
val protobufImportFile = handler(
|
||||||
// TODO: rewrite this with ctx.uploadedFiles(), don't call the multipart field "backup.proto.gz"
|
documentWith = {
|
||||||
ctx.future(
|
withOperation {
|
||||||
future {
|
summary("Restore a backup file")
|
||||||
ProtoBackupImport.performRestore(ctx.uploadedFile("backup.proto.gz")!!.content)
|
description("Expects a Tachiyomi protobuf backup as a file upload, the file must be named \"backup.proto.gz\"")
|
||||||
}
|
}
|
||||||
)
|
uploadedFile("backup.proto.gz") {
|
||||||
}
|
it.description("Protobuf backup")
|
||||||
|
it.required(true)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx ->
|
||||||
|
// TODO: rewrite this with ctx.uploadedFiles(), don't call the multipart field "backup.proto.gz"
|
||||||
|
ctx.future(
|
||||||
|
future {
|
||||||
|
ProtoBackupImport.performRestore(ctx.uploadedFile("backup.proto.gz")!!.content)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** returns a Tachiyomi protobuf backup created from the current database as a body */
|
/** returns a Tachiyomi protobuf backup created from the current database as a body */
|
||||||
fun protobufExport(ctx: Context) {
|
val protobufExport = handler(
|
||||||
ctx.contentType("application/octet-stream")
|
documentWith = {
|
||||||
ctx.future(
|
withOperation {
|
||||||
future {
|
summary("Create a backup")
|
||||||
ProtoBackupExport.createBackup(
|
description("Returns a Tachiyomi protobuf backup created from the current database as a body")
|
||||||
BackupFlags(
|
|
||||||
includeManga = true,
|
|
||||||
includeCategories = true,
|
|
||||||
includeChapters = true,
|
|
||||||
includeTracking = true,
|
|
||||||
includeHistory = true,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
)
|
},
|
||||||
}
|
behaviorOf = { ctx ->
|
||||||
|
ctx.contentType("application/octet-stream")
|
||||||
|
ctx.future(
|
||||||
|
future {
|
||||||
|
ProtoBackupExport.createBackup(
|
||||||
|
BackupFlags(
|
||||||
|
includeManga = true,
|
||||||
|
includeCategories = true,
|
||||||
|
includeChapters = true,
|
||||||
|
includeTracking = true,
|
||||||
|
includeHistory = true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
stream(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** returns a Tachiyomi protobuf backup created from the current database as a file */
|
/** returns a Tachiyomi protobuf backup created from the current database as a file */
|
||||||
fun protobufExportFile(ctx: Context) {
|
val protobufExportFile = handler(
|
||||||
ctx.contentType("application/octet-stream")
|
documentWith = {
|
||||||
val currentDate = SimpleDateFormat("yyyy-MM-dd_HH-mm").format(Date())
|
withOperation {
|
||||||
|
summary("Create a backup file")
|
||||||
ctx.header("Content-Disposition", """attachment; filename="tachidesk_$currentDate.proto.gz"""")
|
description("Returns a Tachiyomi protobuf backup created from the current database as a file")
|
||||||
ctx.future(
|
|
||||||
future {
|
|
||||||
ProtoBackupExport.createBackup(
|
|
||||||
BackupFlags(
|
|
||||||
includeManga = true,
|
|
||||||
includeCategories = true,
|
|
||||||
includeChapters = true,
|
|
||||||
includeTracking = true,
|
|
||||||
includeHistory = true,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
)
|
},
|
||||||
}
|
behaviorOf = { ctx ->
|
||||||
|
ctx.contentType("application/octet-stream")
|
||||||
|
val currentDate = SimpleDateFormat("yyyy-MM-dd_HH-mm").format(Date())
|
||||||
|
|
||||||
|
ctx.header("Content-Disposition", """attachment; filename="tachidesk_$currentDate.proto.gz"""")
|
||||||
|
ctx.future(
|
||||||
|
future {
|
||||||
|
ProtoBackupExport.createBackup(
|
||||||
|
BackupFlags(
|
||||||
|
includeManga = true,
|
||||||
|
includeCategories = true,
|
||||||
|
includeChapters = true,
|
||||||
|
includeTracking = true,
|
||||||
|
includeHistory = true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
stream(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** Reports missing sources and trackers, expects a Tachiyomi protobuf backup in the body */
|
/** Reports missing sources and trackers, expects a Tachiyomi protobuf backup in the body */
|
||||||
fun protobufValidate(ctx: Context) {
|
val protobufValidate = handler(
|
||||||
ctx.future(
|
documentWith = {
|
||||||
future {
|
withOperation {
|
||||||
ProtoBackupValidator.validate(ctx.bodyAsInputStream())
|
summary("Validate a backup")
|
||||||
|
description("Reports missing sources and trackers, expects a Tachiyomi protobuf backup in the body")
|
||||||
}
|
}
|
||||||
)
|
},
|
||||||
}
|
behaviorOf = { ctx ->
|
||||||
|
ctx.future(
|
||||||
|
future {
|
||||||
|
ProtoBackupValidator.validate(ctx.bodyAsInputStream())
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
json<ProtoBackupValidator.ValidationResult>(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** Reports missing sources and trackers, expects a Tachiyomi protobuf backup as a file upload, the file must be named "backup.proto.gz" */
|
/** Reports missing sources and trackers, expects a Tachiyomi protobuf backup as a file upload, the file must be named "backup.proto.gz" */
|
||||||
fun protobufValidateFile(ctx: Context) {
|
val protobufValidateFile = handler(
|
||||||
ctx.future(
|
documentWith = {
|
||||||
future {
|
withOperation {
|
||||||
ProtoBackupValidator.validate(ctx.uploadedFile("backup.proto.gz")!!.content)
|
summary("Validate a backup file")
|
||||||
|
description("Reports missing sources and trackers, expects a Tachiyomi protobuf backup as a file upload, the file must be named \"backup.proto.gz\"")
|
||||||
}
|
}
|
||||||
)
|
uploadedFile("backup.proto.gz") {
|
||||||
}
|
it.description("Protobuf backup")
|
||||||
|
it.required(true)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx ->
|
||||||
|
ctx.future(
|
||||||
|
future {
|
||||||
|
ProtoBackupValidator.validate(ctx.uploadedFile("backup.proto.gz")!!.content)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
json<ProtoBackupValidator.ValidationResult>(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,50 +7,147 @@ package suwayomi.tachidesk.manga.controller
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import io.javalin.http.Context
|
import io.javalin.http.HttpCode
|
||||||
import suwayomi.tachidesk.manga.impl.Category
|
import suwayomi.tachidesk.manga.impl.Category
|
||||||
import suwayomi.tachidesk.manga.impl.CategoryManga
|
import suwayomi.tachidesk.manga.impl.CategoryManga
|
||||||
|
import suwayomi.tachidesk.manga.model.dataclass.CategoryDataClass
|
||||||
|
import suwayomi.tachidesk.manga.model.dataclass.MangaDataClass
|
||||||
|
import suwayomi.tachidesk.server.util.formParam
|
||||||
|
import suwayomi.tachidesk.server.util.handler
|
||||||
|
import suwayomi.tachidesk.server.util.pathParam
|
||||||
|
import suwayomi.tachidesk.server.util.withOperation
|
||||||
|
|
||||||
object CategoryController {
|
object CategoryController {
|
||||||
/** category list */
|
/** category list */
|
||||||
fun categoryList(ctx: Context) {
|
val categoryList = handler(
|
||||||
ctx.json(Category.getCategoryList())
|
documentWith = {
|
||||||
}
|
withOperation {
|
||||||
|
summary("Category list")
|
||||||
|
description("get a list of categories")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx ->
|
||||||
|
ctx.json(Category.getCategoryList())
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
json<Array<CategoryDataClass>>(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** category create */
|
/** category create */
|
||||||
fun categoryCreate(ctx: Context) {
|
val categoryCreate = handler(
|
||||||
val name = ctx.formParam("name")!!
|
formParam<String>("name"),
|
||||||
Category.createCategory(name)
|
documentWith = {
|
||||||
ctx.status(200)
|
withOperation {
|
||||||
}
|
summary("Category create")
|
||||||
|
description("Create a category")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, name ->
|
||||||
|
if (Category.createCategory(name) != -1) {
|
||||||
|
ctx.status(200)
|
||||||
|
} else {
|
||||||
|
ctx.status(HttpCode.BAD_REQUEST)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
httpCode(HttpCode.BAD_REQUEST)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** category modification */
|
/** category modification */
|
||||||
fun categoryModify(ctx: Context) {
|
val categoryModify = handler(
|
||||||
val categoryId = ctx.pathParam("categoryId").toInt()
|
pathParam<Int>("categoryId"),
|
||||||
val name = ctx.formParam("name")
|
formParam<String?>("name"),
|
||||||
val isDefault = ctx.formParam("default")?.toBoolean()
|
formParam<Boolean?>("default"),
|
||||||
Category.updateCategory(categoryId, name, isDefault)
|
documentWith = {
|
||||||
ctx.status(200)
|
withOperation {
|
||||||
}
|
summary("Category modify")
|
||||||
|
description("Modify a category")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, categoryId, name, isDefault ->
|
||||||
|
Category.updateCategory(categoryId, name, isDefault)
|
||||||
|
ctx.status(200)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** category delete */
|
/** category delete */
|
||||||
fun categoryDelete(ctx: Context) {
|
val categoryDelete = handler(
|
||||||
val categoryId = ctx.pathParam("categoryId").toInt()
|
pathParam<Int>("categoryId"),
|
||||||
Category.removeCategory(categoryId)
|
documentWith = {
|
||||||
ctx.status(200)
|
withOperation {
|
||||||
}
|
summary("Category delete")
|
||||||
|
description("Delete a category")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, categoryId ->
|
||||||
|
Category.removeCategory(categoryId)
|
||||||
|
ctx.status(200)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** returns the manga list associated with a category */
|
/** returns the manga list associated with a category */
|
||||||
fun categoryMangas(ctx: Context) {
|
val categoryMangas = handler(
|
||||||
val categoryId = ctx.pathParam("categoryId").toInt()
|
pathParam<Int>("categoryId"),
|
||||||
ctx.json(CategoryManga.getCategoryMangaList(categoryId))
|
documentWith = {
|
||||||
}
|
withOperation {
|
||||||
|
summary("Category manga")
|
||||||
|
description("Returns the manga list associated with a category")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, categoryId ->
|
||||||
|
ctx.json(CategoryManga.getCategoryMangaList(categoryId))
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
json<Array<MangaDataClass>>(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** category re-ordering */
|
/** category re-ordering */
|
||||||
fun categoryReorder(ctx: Context) {
|
val categoryReorder = handler(
|
||||||
val from = ctx.formParam("from")!!.toInt()
|
formParam<Int>("from"),
|
||||||
val to = ctx.formParam("to")!!.toInt()
|
formParam<Int>("to"),
|
||||||
Category.reorderCategory(from, to)
|
documentWith = {
|
||||||
ctx.status(200)
|
withOperation {
|
||||||
}
|
summary("Category re-ordering")
|
||||||
|
description("Re-order a category")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, from, to ->
|
||||||
|
Category.reorderCategory(from, to)
|
||||||
|
ctx.status(200)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
/** used to modify a category's meta parameters */
|
||||||
|
val meta = handler(
|
||||||
|
pathParam<Int>("categoryId"),
|
||||||
|
formParam<String>("key"),
|
||||||
|
formParam<String>("value"),
|
||||||
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
|
summary("Add meta data to category")
|
||||||
|
description("A simple Key-Value storage in the manga object, you can set values for whatever you want inside it.")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, categoryId, key, value ->
|
||||||
|
Category.modifyMeta(categoryId, key, value)
|
||||||
|
ctx.status(200)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,23 @@ package suwayomi.tachidesk.manga.controller
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import io.javalin.http.Context
|
import io.javalin.http.HttpCode
|
||||||
import io.javalin.websocket.WsConfig
|
import io.javalin.websocket.WsConfig
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import org.kodein.di.DI
|
||||||
|
import org.kodein.di.conf.global
|
||||||
|
import org.kodein.di.instance
|
||||||
import suwayomi.tachidesk.manga.impl.download.DownloadManager
|
import suwayomi.tachidesk.manga.impl.download.DownloadManager
|
||||||
|
import suwayomi.tachidesk.manga.impl.download.DownloadManager.EnqueueInput
|
||||||
import suwayomi.tachidesk.server.JavalinSetup.future
|
import suwayomi.tachidesk.server.JavalinSetup.future
|
||||||
|
import suwayomi.tachidesk.server.util.handler
|
||||||
|
import suwayomi.tachidesk.server.util.pathParam
|
||||||
|
import suwayomi.tachidesk.server.util.withOperation
|
||||||
|
|
||||||
object DownloadController {
|
object DownloadController {
|
||||||
|
private val json by DI.global.instance<Json>()
|
||||||
|
|
||||||
/** Download queue stats */
|
/** Download queue stats */
|
||||||
fun downloadsWS(ws: WsConfig) {
|
fun downloadsWS(ws: WsConfig) {
|
||||||
ws.onConnect { ctx ->
|
ws.onConnect { ctx ->
|
||||||
@@ -28,45 +39,159 @@ object DownloadController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Start the downloader */
|
/** Start the downloader */
|
||||||
fun start(ctx: Context) {
|
val start = handler(
|
||||||
DownloadManager.start()
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
ctx.status(200)
|
summary("Downloader start")
|
||||||
}
|
description("Start the downloader")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = {
|
||||||
|
DownloadManager.start()
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** Stop the downloader */
|
/** Stop the downloader */
|
||||||
fun stop(ctx: Context) {
|
val stop = handler(
|
||||||
DownloadManager.stop()
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
ctx.status(200)
|
summary("Downloader stop")
|
||||||
}
|
description("Stop the downloader")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx ->
|
||||||
|
ctx.future(
|
||||||
|
future { DownloadManager.stop() }
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** clear download queue */
|
/** clear download queue */
|
||||||
fun clear(ctx: Context) {
|
val clear = handler(
|
||||||
DownloadManager.clear()
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
ctx.status(200)
|
summary("Downloader clear")
|
||||||
}
|
description("Clear download queue")
|
||||||
|
|
||||||
/** Queue chapter for download */
|
|
||||||
fun queueChapter(ctx: Context) {
|
|
||||||
val chapterIndex = ctx.pathParam("chapterIndex").toInt()
|
|
||||||
val mangaId = ctx.pathParam("mangaId").toInt()
|
|
||||||
|
|
||||||
ctx.future(
|
|
||||||
future {
|
|
||||||
DownloadManager.enqueue(chapterIndex, mangaId)
|
|
||||||
}
|
}
|
||||||
)
|
},
|
||||||
}
|
behaviorOf = { ctx ->
|
||||||
|
ctx.future(
|
||||||
|
future { DownloadManager.clear() }
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
/** Queue single chapter for download */
|
||||||
|
val queueChapter = handler(
|
||||||
|
pathParam<Int>("chapterIndex"),
|
||||||
|
pathParam<Int>("mangaId"),
|
||||||
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
|
summary("Downloader add single chapter")
|
||||||
|
description("Queue single chapter for download")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, chapterIndex, mangaId ->
|
||||||
|
ctx.future(
|
||||||
|
future {
|
||||||
|
DownloadManager.enqueueWithChapterIndex(mangaId, chapterIndex)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
val queueChapters = handler(
|
||||||
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
|
summary("Downloader add multiple chapters")
|
||||||
|
description("Queue multiple chapters for download")
|
||||||
|
}
|
||||||
|
body<EnqueueInput>()
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx ->
|
||||||
|
val inputs = json.decodeFromString<EnqueueInput>(ctx.body())
|
||||||
|
ctx.future(
|
||||||
|
future {
|
||||||
|
DownloadManager.enqueue(inputs)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
/** delete multiple chapters from download queue */
|
||||||
|
val unqueueChapters = handler(
|
||||||
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
|
summary("Downloader remove multiple downloads")
|
||||||
|
description("Remove multiple chapters downloads from queue")
|
||||||
|
}
|
||||||
|
body<EnqueueInput>()
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx ->
|
||||||
|
val input = json.decodeFromString<EnqueueInput>(ctx.body())
|
||||||
|
ctx.future(
|
||||||
|
future {
|
||||||
|
DownloadManager.unqueue(input)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** delete chapter from download queue */
|
/** delete chapter from download queue */
|
||||||
fun unqueueChapter(ctx: Context) {
|
val unqueueChapter = handler(
|
||||||
val chapterIndex = ctx.pathParam("chapterIndex").toInt()
|
pathParam<Int>("chapterIndex"),
|
||||||
val mangaId = ctx.pathParam("mangaId").toInt()
|
pathParam<Int>("mangaId"),
|
||||||
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
|
summary("Downloader remove chapter")
|
||||||
|
description("Delete chapter from download queue")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, chapterIndex, mangaId ->
|
||||||
|
DownloadManager.unqueue(chapterIndex, mangaId)
|
||||||
|
|
||||||
DownloadManager.unqueue(chapterIndex, mangaId)
|
ctx.status(200)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
ctx.status(200)
|
/** clear download queue */
|
||||||
}
|
val reorderChapter = handler(
|
||||||
|
pathParam<Int>("chapterIndex"),
|
||||||
|
pathParam<Int>("mangaId"),
|
||||||
|
pathParam<Int>("to"),
|
||||||
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
|
summary("Downloader reorder chapter")
|
||||||
|
description("Reorder chapter in download queue")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { _, chapterIndex, mangaId, to ->
|
||||||
|
DownloadManager.reorder(chapterIndex, mangaId, to)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+130
-51
@@ -7,78 +7,157 @@ package suwayomi.tachidesk.manga.controller
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import io.javalin.http.Context
|
import io.javalin.http.HttpCode
|
||||||
import mu.KotlinLogging
|
import mu.KotlinLogging
|
||||||
import suwayomi.tachidesk.manga.impl.extension.Extension
|
import suwayomi.tachidesk.manga.impl.extension.Extension
|
||||||
import suwayomi.tachidesk.manga.impl.extension.ExtensionsList
|
import suwayomi.tachidesk.manga.impl.extension.ExtensionsList
|
||||||
|
import suwayomi.tachidesk.manga.model.dataclass.ExtensionDataClass
|
||||||
import suwayomi.tachidesk.server.JavalinSetup.future
|
import suwayomi.tachidesk.server.JavalinSetup.future
|
||||||
|
import suwayomi.tachidesk.server.util.handler
|
||||||
|
import suwayomi.tachidesk.server.util.pathParam
|
||||||
|
import suwayomi.tachidesk.server.util.withOperation
|
||||||
|
|
||||||
object ExtensionController {
|
object ExtensionController {
|
||||||
private val logger = KotlinLogging.logger {}
|
private val logger = KotlinLogging.logger {}
|
||||||
|
|
||||||
/** list all extensions */
|
/** list all extensions */
|
||||||
fun list(ctx: Context) {
|
val list = handler(
|
||||||
ctx.future(
|
documentWith = {
|
||||||
future {
|
withOperation {
|
||||||
ExtensionsList.getExtensionList()
|
summary("Extension list")
|
||||||
|
description("List all extensions")
|
||||||
}
|
}
|
||||||
)
|
},
|
||||||
}
|
behaviorOf = { ctx ->
|
||||||
|
ctx.future(
|
||||||
|
future {
|
||||||
|
ExtensionsList.getExtensionList()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
json<Array<ExtensionDataClass>>(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** install extension identified with "pkgName" */
|
/** install extension identified with "pkgName" */
|
||||||
fun install(ctx: Context) {
|
val install = handler(
|
||||||
val pkgName = ctx.pathParam("pkgName")
|
pathParam<String>("pkgName"),
|
||||||
|
documentWith = {
|
||||||
ctx.future(
|
withOperation {
|
||||||
future {
|
summary("Extension install")
|
||||||
Extension.installExtension(pkgName)
|
description("install extension identified with \"pkgName\"")
|
||||||
}
|
}
|
||||||
)
|
},
|
||||||
}
|
behaviorOf = { ctx, pkgName ->
|
||||||
|
ctx.future(
|
||||||
|
future {
|
||||||
|
Extension.installExtension(pkgName)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.CREATED)
|
||||||
|
httpCode(HttpCode.FOUND)
|
||||||
|
httpCode(HttpCode.INTERNAL_SERVER_ERROR)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** install the uploaded apk file */
|
/** install the uploaded apk file */
|
||||||
fun installFile(ctx: Context) {
|
val installFile = handler(
|
||||||
|
documentWith = {
|
||||||
val uploadedFile = ctx.uploadedFile("file")!!
|
withOperation {
|
||||||
logger.debug { "Uploaded extension file name: " + uploadedFile.filename }
|
summary("Extension install apk")
|
||||||
|
description("Install the uploaded apk file")
|
||||||
ctx.future(
|
|
||||||
future {
|
|
||||||
Extension.installExternalExtension(uploadedFile.content, uploadedFile.filename)
|
|
||||||
}
|
}
|
||||||
)
|
uploadedFile("file") {
|
||||||
}
|
it.description("Extension apk")
|
||||||
|
it.required(true)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx ->
|
||||||
|
val uploadedFile = ctx.uploadedFile("file")!!
|
||||||
|
logger.debug { "Uploaded extension file name: " + uploadedFile.filename }
|
||||||
|
|
||||||
|
ctx.future(
|
||||||
|
future {
|
||||||
|
Extension.installExternalExtension(uploadedFile.content, uploadedFile.filename)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.CREATED)
|
||||||
|
httpCode(HttpCode.FOUND)
|
||||||
|
httpCode(HttpCode.INTERNAL_SERVER_ERROR)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** update extension identified with "pkgName" */
|
/** update extension identified with "pkgName" */
|
||||||
fun update(ctx: Context) {
|
val update = handler(
|
||||||
val pkgName = ctx.pathParam("pkgName")
|
pathParam<String>("pkgName"),
|
||||||
|
documentWith = {
|
||||||
ctx.future(
|
withOperation {
|
||||||
future {
|
summary("Extension update")
|
||||||
Extension.updateExtension(pkgName)
|
description("Update extension identified with \"pkgName\"")
|
||||||
}
|
}
|
||||||
)
|
},
|
||||||
}
|
behaviorOf = { ctx, pkgName ->
|
||||||
|
ctx.future(
|
||||||
|
future {
|
||||||
|
Extension.updateExtension(pkgName)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.CREATED)
|
||||||
|
httpCode(HttpCode.FOUND)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
|
httpCode(HttpCode.INTERNAL_SERVER_ERROR)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** uninstall extension identified with "pkgName" */
|
/** uninstall extension identified with "pkgName" */
|
||||||
fun uninstall(ctx: Context) {
|
val uninstall = handler(
|
||||||
val pkgName = ctx.pathParam("pkgName")
|
pathParam<String>("pkgName"),
|
||||||
|
documentWith = {
|
||||||
Extension.uninstallExtension(pkgName)
|
withOperation {
|
||||||
ctx.status(200)
|
summary("Extension uninstall")
|
||||||
}
|
description("Uninstall extension identified with \"pkgName\"")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, pkgName ->
|
||||||
|
Extension.uninstallExtension(pkgName)
|
||||||
|
ctx.status(200)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.CREATED)
|
||||||
|
httpCode(HttpCode.FOUND)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
|
httpCode(HttpCode.INTERNAL_SERVER_ERROR)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** icon for extension named `apkName` */
|
/** icon for extension named `apkName` */
|
||||||
fun icon(ctx: Context) {
|
val icon = handler(
|
||||||
val apkName = ctx.pathParam("apkName")
|
pathParam<String>("apkName"),
|
||||||
val useCache = ctx.queryParam("useCache")?.toBoolean() ?: true
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
ctx.future(
|
summary("Extension icon")
|
||||||
future { Extension.getExtensionIcon(apkName, useCache) }
|
description("Icon for extension named `apkName`")
|
||||||
.thenApply {
|
}
|
||||||
ctx.header("content-type", it.second)
|
},
|
||||||
it.first
|
behaviorOf = { ctx, apkName ->
|
||||||
}
|
ctx.future(
|
||||||
)
|
future { Extension.getExtensionIcon(apkName) }
|
||||||
}
|
.thenApply {
|
||||||
|
ctx.header("content-type", it.second)
|
||||||
|
it.first
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
image(HttpCode.OK)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,28 +7,39 @@ package suwayomi.tachidesk.manga.controller
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import io.javalin.http.Context
|
import io.javalin.http.HttpCode
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import org.kodein.di.DI
|
||||||
|
import org.kodein.di.conf.global
|
||||||
|
import org.kodein.di.instance
|
||||||
import suwayomi.tachidesk.manga.impl.CategoryManga
|
import suwayomi.tachidesk.manga.impl.CategoryManga
|
||||||
import suwayomi.tachidesk.manga.impl.Chapter
|
import suwayomi.tachidesk.manga.impl.Chapter
|
||||||
import suwayomi.tachidesk.manga.impl.Library
|
import suwayomi.tachidesk.manga.impl.Library
|
||||||
import suwayomi.tachidesk.manga.impl.Manga
|
import suwayomi.tachidesk.manga.impl.Manga
|
||||||
import suwayomi.tachidesk.manga.impl.Page
|
import suwayomi.tachidesk.manga.impl.Page
|
||||||
|
import suwayomi.tachidesk.manga.impl.chapter.getChapterDownloadReady
|
||||||
|
import suwayomi.tachidesk.manga.model.dataclass.CategoryDataClass
|
||||||
|
import suwayomi.tachidesk.manga.model.dataclass.ChapterDataClass
|
||||||
import suwayomi.tachidesk.manga.model.dataclass.MangaDataClass
|
import suwayomi.tachidesk.manga.model.dataclass.MangaDataClass
|
||||||
import suwayomi.tachidesk.server.JavalinSetup.future
|
import suwayomi.tachidesk.server.JavalinSetup.future
|
||||||
|
import suwayomi.tachidesk.server.util.formParam
|
||||||
import suwayomi.tachidesk.server.util.handler
|
import suwayomi.tachidesk.server.util.handler
|
||||||
import suwayomi.tachidesk.server.util.pathParam
|
import suwayomi.tachidesk.server.util.pathParam
|
||||||
import suwayomi.tachidesk.server.util.queryParam
|
import suwayomi.tachidesk.server.util.queryParam
|
||||||
import suwayomi.tachidesk.server.util.withOperation
|
import suwayomi.tachidesk.server.util.withOperation
|
||||||
|
import kotlin.time.Duration.Companion.days
|
||||||
|
|
||||||
object MangaController {
|
object MangaController {
|
||||||
/** get manga info */
|
private val json by DI.global.instance<Json>()
|
||||||
|
|
||||||
val retrieve = handler(
|
val retrieve = handler(
|
||||||
pathParam<Int>("mangaId"),
|
pathParam<Int>("mangaId"),
|
||||||
queryParam("onlineFetch", false),
|
queryParam("onlineFetch", false),
|
||||||
documentWith = {
|
documentWith = {
|
||||||
withOperation {
|
withOperation {
|
||||||
summary("Get a manga")
|
summary("Get manga info")
|
||||||
description("Get a manga from the database using a specific id")
|
description("Get a manga from the database using a specific id.")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
behaviorOf = { ctx, mangaId, onlineFetch ->
|
behaviorOf = { ctx, mangaId, onlineFetch ->
|
||||||
@@ -39,145 +50,350 @@ object MangaController {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
withResults = {
|
withResults = {
|
||||||
json<MangaDataClass>("OK")
|
json<MangaDataClass>(HttpCode.OK)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
/** get manga info with all data filled in */
|
||||||
|
val retrieveFull = handler(
|
||||||
|
pathParam<Int>("mangaId"),
|
||||||
|
queryParam("onlineFetch", false),
|
||||||
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
|
summary("Get manga info with all data filled in")
|
||||||
|
description("Get a manga from the database using a specific id.")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, mangaId, onlineFetch ->
|
||||||
|
ctx.future(
|
||||||
|
future {
|
||||||
|
Manga.getMangaFull(mangaId, onlineFetch)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
json<MangaDataClass>(HttpCode.OK)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
/** manga thumbnail */
|
/** manga thumbnail */
|
||||||
fun thumbnail(ctx: Context) {
|
val thumbnail = handler(
|
||||||
val mangaId = ctx.pathParam("mangaId").toInt()
|
pathParam<Int>("mangaId"),
|
||||||
val useCache = ctx.queryParam("useCache")?.toBoolean() ?: true
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
ctx.future(
|
summary("Get a manga thumbnail")
|
||||||
future { Manga.getMangaThumbnail(mangaId, useCache) }
|
description("Get a manga thumbnail from the source or the cache.")
|
||||||
.thenApply {
|
}
|
||||||
ctx.header("content-type", it.second)
|
},
|
||||||
val httpCacheSeconds = 60 * 60 * 24
|
behaviorOf = { ctx, mangaId ->
|
||||||
ctx.header("cache-control", "max-age=$httpCacheSeconds")
|
ctx.future(
|
||||||
it.first
|
future { Manga.getMangaThumbnail(mangaId) }
|
||||||
}
|
.thenApply {
|
||||||
)
|
ctx.header("content-type", it.second)
|
||||||
}
|
val httpCacheSeconds = 1.days.inWholeSeconds
|
||||||
|
ctx.header("cache-control", "max-age=$httpCacheSeconds")
|
||||||
|
it.first
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
image(HttpCode.OK)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** adds the manga to library */
|
/** adds the manga to library */
|
||||||
fun addToLibrary(ctx: Context) {
|
val addToLibrary = handler(
|
||||||
val mangaId = ctx.pathParam("mangaId").toInt()
|
pathParam<Int>("mangaId"),
|
||||||
|
documentWith = {
|
||||||
ctx.future(
|
withOperation {
|
||||||
future { Library.addMangaToLibrary(mangaId) }
|
summary("Add manga to library")
|
||||||
)
|
description("Use a manga id to add the manga to your library.\nWill do nothing if manga is already in your library.")
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, mangaId ->
|
||||||
|
ctx.future(
|
||||||
|
future { Library.addMangaToLibrary(mangaId) }
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** removes the manga from the library */
|
/** removes the manga from the library */
|
||||||
fun removeFromLibrary(ctx: Context) {
|
val removeFromLibrary = handler(
|
||||||
val mangaId = ctx.pathParam("mangaId").toInt()
|
pathParam<Int>("mangaId"),
|
||||||
|
documentWith = {
|
||||||
ctx.future(
|
withOperation {
|
||||||
future { Library.removeMangaFromLibrary(mangaId) }
|
summary("Remove manga to library")
|
||||||
)
|
description("Use a manga id to remove the manga to your library.\nWill do nothing if manga not in your library.")
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, mangaId ->
|
||||||
|
ctx.future(
|
||||||
|
future { Library.removeMangaFromLibrary(mangaId) }
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** list manga's categories */
|
/** list manga's categories */
|
||||||
fun categoryList(ctx: Context) {
|
val categoryList = handler(
|
||||||
val mangaId = ctx.pathParam("mangaId").toInt()
|
pathParam<Int>("mangaId"),
|
||||||
ctx.json(CategoryManga.getMangaCategories(mangaId))
|
documentWith = {
|
||||||
}
|
withOperation {
|
||||||
|
summary("Get a manga's categories")
|
||||||
|
description("Get the list of categories for this manga")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, mangaId ->
|
||||||
|
ctx.json(CategoryManga.getMangaCategories(mangaId))
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
json<Array<CategoryDataClass>>(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** adds the manga to category */
|
/** adds the manga to category */
|
||||||
fun addToCategory(ctx: Context) {
|
val addToCategory = handler(
|
||||||
val mangaId = ctx.pathParam("mangaId").toInt()
|
pathParam<Int>("mangaId"),
|
||||||
val categoryId = ctx.pathParam("categoryId").toInt()
|
pathParam<Int>("categoryId"),
|
||||||
CategoryManga.addMangaToCategory(mangaId, categoryId)
|
documentWith = {
|
||||||
ctx.status(200)
|
withOperation {
|
||||||
}
|
summary("Add manga to category")
|
||||||
|
description("Add a manga to a category using their ids.")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, mangaId, categoryId ->
|
||||||
|
CategoryManga.addMangaToCategory(mangaId, categoryId)
|
||||||
|
ctx.status(200)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** removes the manga from the category */
|
/** removes the manga from the category */
|
||||||
fun removeFromCategory(ctx: Context) {
|
val removeFromCategory = handler(
|
||||||
val mangaId = ctx.pathParam("mangaId").toInt()
|
pathParam<Int>("mangaId"),
|
||||||
val categoryId = ctx.pathParam("categoryId").toInt()
|
pathParam<Int>("categoryId"),
|
||||||
CategoryManga.removeMangaFromCategory(mangaId, categoryId)
|
documentWith = {
|
||||||
ctx.status(200)
|
withOperation {
|
||||||
}
|
summary("Remove manga from category")
|
||||||
|
description("Remove a manga from a category using their ids.")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, mangaId, categoryId ->
|
||||||
|
CategoryManga.removeMangaFromCategory(mangaId, categoryId)
|
||||||
|
ctx.status(200)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** used to modify a manga's meta parameters */
|
/** used to modify a manga's meta parameters */
|
||||||
fun meta(ctx: Context) {
|
val meta = handler(
|
||||||
val mangaId = ctx.pathParam("mangaId").toInt()
|
pathParam<Int>("mangaId"),
|
||||||
|
formParam<String>("key"),
|
||||||
val key = ctx.formParam("key")!!
|
formParam<String>("value"),
|
||||||
val value = ctx.formParam("value")!!
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
Manga.modifyMangaMeta(mangaId, key, value)
|
summary("Add data to manga")
|
||||||
|
description("A simple Key-Value storage in the manga object, you can set values for whatever you want inside it.")
|
||||||
ctx.status(200)
|
}
|
||||||
}
|
},
|
||||||
|
behaviorOf = { ctx, mangaId, key, value ->
|
||||||
|
Manga.modifyMangaMeta(mangaId, key, value)
|
||||||
|
ctx.status(200)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** get chapter list when showing a manga */
|
/** get chapter list when showing a manga */
|
||||||
fun chapterList(ctx: Context) {
|
val chapterList = handler(
|
||||||
val mangaId = ctx.pathParam("mangaId").toInt()
|
pathParam<Int>("mangaId"),
|
||||||
|
queryParam("onlineFetch", false),
|
||||||
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
|
summary("Get manga chapter list")
|
||||||
|
description("Get the manga chapter list from the database or online. If there is no chapters in the database it fetches the chapters online. Use onlineFetch to update chapter list.")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, mangaId, onlineFetch ->
|
||||||
|
ctx.future(future { Chapter.getChapterList(mangaId, onlineFetch) })
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
json<Array<ChapterDataClass>>(HttpCode.OK)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
val onlineFetch = ctx.queryParam("onlineFetch")?.toBoolean() ?: false
|
/** batch edit chapters of single manga */
|
||||||
|
val chapterBatch = handler(
|
||||||
|
pathParam<Int>("mangaId"),
|
||||||
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
|
summary("Chapters update multiple")
|
||||||
|
description("Update multiple chapters of single manga. For batch marking as read, or bookmarking")
|
||||||
|
}
|
||||||
|
body<Chapter.MangaChapterBatchEditInput>()
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, mangaId ->
|
||||||
|
val input = json.decodeFromString<Chapter.MangaChapterBatchEditInput>(ctx.body())
|
||||||
|
Chapter.modifyChapters(input, mangaId)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
ctx.future(future { Chapter.getChapterList(mangaId, onlineFetch) })
|
/** batch edit chapters from multiple manga */
|
||||||
}
|
val anyChapterBatch = handler(
|
||||||
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
|
summary("Chapters update multiple")
|
||||||
|
description("Update multiple chapters on any manga. For batch marking as read, or bookmarking")
|
||||||
|
}
|
||||||
|
body<Chapter.ChapterBatchEditInput>()
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx ->
|
||||||
|
val input = json.decodeFromString<Chapter.ChapterBatchEditInput>(ctx.body())
|
||||||
|
Chapter.modifyChapters(
|
||||||
|
Chapter.MangaChapterBatchEditInput(
|
||||||
|
input.chapterIds,
|
||||||
|
null,
|
||||||
|
input.change
|
||||||
|
)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
httpCode(HttpCode.OK)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** used to display a chapter, get a chapter in order to show its pages */
|
/** used to display a chapter, get a chapter in order to show its pages */
|
||||||
fun chapterRetrieve(ctx: Context) {
|
val chapterRetrieve = handler(
|
||||||
val chapterIndex = ctx.pathParam("chapterIndex").toInt()
|
pathParam<Int>("mangaId"),
|
||||||
val mangaId = ctx.pathParam("mangaId").toInt()
|
pathParam<Int>("chapterIndex"),
|
||||||
ctx.future(future { Chapter.getChapter(chapterIndex, mangaId) })
|
documentWith = {
|
||||||
}
|
withOperation {
|
||||||
|
summary("Get a chapter")
|
||||||
|
description("Get the chapter from the manga id and chapter index. It will also retrieve the pages for this chapter.")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, mangaId, chapterIndex ->
|
||||||
|
ctx.future(future { getChapterDownloadReady(chapterIndex, mangaId) })
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
json<ChapterDataClass>(HttpCode.OK)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** used to modify a chapter's parameters */
|
/** used to modify a chapter's parameters */
|
||||||
fun chapterModify(ctx: Context) {
|
val chapterModify = handler(
|
||||||
val chapterIndex = ctx.pathParam("chapterIndex").toInt()
|
pathParam<Int>("mangaId"),
|
||||||
val mangaId = ctx.pathParam("mangaId").toInt()
|
pathParam<Int>("chapterIndex"),
|
||||||
|
formParam<Boolean?>("read"),
|
||||||
|
formParam<Boolean?>("bookmarked"),
|
||||||
|
formParam<Boolean?>("markPrevRead"),
|
||||||
|
formParam<Int?>("lastPageRead"),
|
||||||
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
|
summary("Modify a chapter")
|
||||||
|
description("Update user info for a given chapter, such as read status, bookmarked, and more.")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, mangaId, chapterIndex, read, bookmarked, markPrevRead, lastPageRead ->
|
||||||
|
Chapter.modifyChapter(mangaId, chapterIndex, read, bookmarked, markPrevRead, lastPageRead)
|
||||||
|
|
||||||
val read = ctx.formParam("read")?.toBoolean()
|
ctx.status(200)
|
||||||
val bookmarked = ctx.formParam("bookmarked")?.toBoolean()
|
},
|
||||||
val markPrevRead = ctx.formParam("markPrevRead")?.toBoolean()
|
withResults = {
|
||||||
val lastPageRead = ctx.formParam("lastPageRead")?.toInt()
|
httpCode(HttpCode.OK)
|
||||||
|
}
|
||||||
Chapter.modifyChapter(mangaId, chapterIndex, read, bookmarked, markPrevRead, lastPageRead)
|
)
|
||||||
|
|
||||||
ctx.status(200)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** delete a downloaded chapter */
|
/** delete a downloaded chapter */
|
||||||
fun chapterDelete(ctx: Context) {
|
val chapterDelete = handler(
|
||||||
val chapterIndex = ctx.pathParam("chapterIndex").toInt()
|
pathParam<Int>("mangaId"),
|
||||||
val mangaId = ctx.pathParam("mangaId").toInt()
|
pathParam<Int>("chapterIndex"),
|
||||||
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
|
summary("Delete a chapter download")
|
||||||
|
description("Delete the downloaded chapter and its files.")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, mangaId, chapterIndex ->
|
||||||
|
Chapter.deleteChapter(mangaId, chapterIndex)
|
||||||
|
|
||||||
Chapter.deleteChapter(mangaId, chapterIndex)
|
ctx.status(200)
|
||||||
|
},
|
||||||
ctx.status(200)
|
withResults = {
|
||||||
}
|
httpCode(HttpCode.OK)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/** used to modify a chapter's meta parameters */
|
/** used to modify a chapter's meta parameters */
|
||||||
fun chapterMeta(ctx: Context) {
|
val chapterMeta = handler(
|
||||||
val chapterIndex = ctx.pathParam("chapterIndex").toInt()
|
pathParam<Int>("mangaId"),
|
||||||
val mangaId = ctx.pathParam("mangaId").toInt()
|
pathParam<Int>("chapterIndex"),
|
||||||
|
formParam<String>("key"),
|
||||||
|
formParam<String>("value"),
|
||||||
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
|
summary("Add data to chapter")
|
||||||
|
description("A simple Key-Value storage in the chapter object, you can set values for whatever you want inside it.")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behaviorOf = { ctx, mangaId, chapterIndex, key, value ->
|
||||||
|
Chapter.modifyChapterMeta(mangaId, chapterIndex, key, value)
|
||||||
|
|
||||||
val key = ctx.formParam("key")!!
|
ctx.status(200)
|
||||||
val value = ctx.formParam("value")!!
|
},
|
||||||
|
withResults = {
|
||||||
Chapter.modifyChapterMeta(mangaId, chapterIndex, key, value)
|
httpCode(HttpCode.OK)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
ctx.status(200)
|
}
|
||||||
}
|
)
|
||||||
|
|
||||||
/** get page at index "index" */
|
/** get page at index "index" */
|
||||||
fun pageRetrieve(ctx: Context) {
|
val pageRetrieve = handler(
|
||||||
val mangaId = ctx.pathParam("mangaId").toInt()
|
pathParam<Int>("mangaId"),
|
||||||
val chapterIndex = ctx.pathParam("chapterIndex").toInt()
|
pathParam<Int>("chapterIndex"),
|
||||||
val index = ctx.pathParam("index").toInt()
|
pathParam<Int>("index"),
|
||||||
val useCache = ctx.queryParam("useCache")?.toBoolean() ?: true
|
documentWith = {
|
||||||
|
withOperation {
|
||||||
ctx.future(
|
summary("Get a chapter page")
|
||||||
future { Page.getPageImage(mangaId, chapterIndex, index, useCache) }
|
description("Get a chapter page for a given index. Cache use can be disabled so it only retrieves it directly from the source.")
|
||||||
.thenApply {
|
}
|
||||||
ctx.header("content-type", it.second)
|
},
|
||||||
it.first
|
behaviorOf = { ctx, mangaId, chapterIndex, index ->
|
||||||
}
|
ctx.future(
|
||||||
)
|
future { Page.getPageImage(mangaId, chapterIndex, index) }
|
||||||
}
|
.thenApply {
|
||||||
|
ctx.header("content-type", it.second)
|
||||||
|
val httpCacheSeconds = 1.days.inWholeSeconds
|
||||||
|
ctx.header("cache-control", "max-age=$httpCacheSeconds")
|
||||||
|
it.first
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
withResults = {
|
||||||
|
image(HttpCode.OK)
|
||||||
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user