mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2024-10-31 22:45:06 +01:00
Electron launcher
This commit is contained in:
parent
71661f70b6
commit
08e8a9d105
35
.github/workflows/build_push.yml
vendored
35
.github/workflows/build_push.yml
vendored
@ -75,14 +75,29 @@ jobs:
|
||||
./windows-bundler.sh win32
|
||||
./windows-bundler.sh win64
|
||||
|
||||
- name: Checkout preview branch
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: 'Suwayomi/Tachidesk-preview'
|
||||
ref: main
|
||||
path: preview
|
||||
token: ${{ secrets.DEPLOY_PREVIEW_TOKEN }}
|
||||
# - name: Checkout preview branch
|
||||
# uses: actions/checkout@v2
|
||||
# with:
|
||||
# repository: 'Suwayomi/Tachidesk-preview'
|
||||
# ref: main
|
||||
# path: preview
|
||||
# token: ${{ secrets.DEPLOY_PREVIEW_TOKEN }}
|
||||
|
||||
- name: Deploy preview
|
||||
run: |
|
||||
./master/.github/scripts/commit-preview.sh
|
||||
- name: Upload Release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
token: ${{ secrets.DEPLOY_PREVIEW_TOKEN }}
|
||||
artifacts: "master/server/build/*.jar,master/server/build/*.zip"
|
||||
draft: true
|
||||
owner: "Suwayomi"
|
||||
repo: "Tachidesk-preview"
|
||||
|
||||
|
||||
# - name: Upload Release
|
||||
# uses: xresloader/upload-to-github-release@v1
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# with:
|
||||
# file: "master/server/build/*.jar;master/server/build/*.zip"
|
||||
# draft: false
|
||||
# verbose: true
|
4
.github/workflows/publish.yml
vendored
4
.github/workflows/publish.yml
vendored
@ -75,11 +75,11 @@ jobs:
|
||||
./windows-bundler.sh win64
|
||||
|
||||
- name: Upload Release
|
||||
uses: xresloader/upload-to-github-release@master
|
||||
uses: xresloader/upload-to-github-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
file: "master/server/build/*.jar;master/server/build/*.z*"
|
||||
file: "master/server/build/*.jar;master/server/build/*.zip"
|
||||
tags: true
|
||||
draft: true
|
||||
verbose: true
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -13,3 +13,4 @@ server/tachiserver-data/
|
||||
# bundle asset downlaods
|
||||
OpenJDK*.zip
|
||||
electron-*.zip
|
||||
rcedit-*
|
||||
|
@ -1 +1 @@
|
||||
electron\electron.exe "http://127.0.0.1:4567"
|
||||
jre\bin\javaw "-Dir.armor.tachidesk.webInterface=electron" "-Dir.armor.tachidesk.electronPath=electron/electron.exe" -jar Tachidesk.jar
|
||||
|
@ -6,14 +6,16 @@
|
||||
# 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="v12.0.9"
|
||||
|
||||
if [ $1 = "win32" ]; then
|
||||
jre="OpenJDK8U-jre_x86-32_windows_hotspot_8u292b10.zip"
|
||||
arch="win32"
|
||||
electron="electron-v12.0.9-win32-ia32.zip"
|
||||
electron="electron-$electron_version-win32-ia32.zip"
|
||||
else
|
||||
jre="OpenJDK8U-jre_x64_windows_hotspot_8u292b10.zip"
|
||||
arch="win64"
|
||||
electron="electron-v12.0.9-win32-x64.zip"
|
||||
electron="electron-$electron_version-win32-x64.zip"
|
||||
fi
|
||||
|
||||
jre_dir="jdk8u292-b10-jre"
|
||||
@ -38,26 +40,44 @@ mv $jre_dir $release_name/jre
|
||||
|
||||
echo "Dealing with electron"
|
||||
if [ ! -f $electron ]; then
|
||||
curl -L "https://github.com/electron/electron/releases/download/v12.0.9/$electron" -o $electron
|
||||
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 Launcher-$arch.exe" "$release_name/Tachidesk Launcher.exe"
|
||||
cp "resources/Tachidesk Launcher.bat" $release_name
|
||||
#cp "resources/Tachidesk Launcher-$arch.exe" "$release_name/Tachidesk Launcher.exe"
|
||||
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 -s90 -r $zip_name $release_name
|
||||
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/$release_name.z*
|
||||
rm ../server/build/$zip_name
|
||||
fi
|
||||
|
||||
mv $release_name.z* ../server/build/
|
||||
mv $zip_name ../server/build/
|
||||
|
@ -75,7 +75,12 @@ dependencies {
|
||||
val MainClass = "ir.armor.tachidesk.MainKt"
|
||||
application {
|
||||
mainClass.set(MainClass)
|
||||
// applicationDefaultJvmArgs = listOf("-Dir.armor.tachidesk.openInWebview=true")
|
||||
|
||||
// for testing electron
|
||||
// applicationDefaultJvmArgs = listOf(
|
||||
// "-Dir.armor.tachidesk.webInterface=electron",
|
||||
// "-Dir.armor.tachidesk.electronPath=/home/armor/programming/Suwayomi/Tachidesk/scripts/electron-v12.0.9-linux-x64/electron"
|
||||
// )
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
@ -14,15 +14,16 @@ object Browser {
|
||||
private val appIP = if (serverConfig.ip == "0.0.0.0") "127.0.0.1" else serverConfig.ip
|
||||
private val appBaseUrl = "http://$appIP:${serverConfig.port}"
|
||||
|
||||
private val webViewInstances = mutableListOf<Any>()
|
||||
private val electronInstances = mutableListOf<Any>()
|
||||
|
||||
fun openInBrowser() {
|
||||
|
||||
val openInWebView = System.getProperty("ir.armor.tachidesk.openInWebview")?.toBoolean()
|
||||
val openInElectron = System.getProperty("ir.armor.tachidesk.webInterface")?.equals("electron")
|
||||
|
||||
if (openInWebView == true) {
|
||||
if (openInElectron == true) {
|
||||
try {
|
||||
// TODO
|
||||
val electronPath = System.getProperty("ir.armor.tachidesk.electronPath")!!
|
||||
electronInstances.add(ProcessBuilder(electronPath, appBaseUrl).start())
|
||||
} catch (e: Throwable) { // cover both java.lang.Exception and java.lang.Error
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user