built wails project
24
FCLauncher.old/.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
3
FCLauncher.old/.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"]
|
||||
}
|
7
FCLauncher.old/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# Tauri + Vanilla
|
||||
|
||||
This template should help get you started developing with Tauri in vanilla HTML, CSS and Javascript.
|
||||
|
||||
## Recommended IDE Setup
|
||||
|
||||
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)
|
BIN
FCLauncher.old/app-icon.png
Normal file
After Width: | Height: | Size: 123 KiB |
14
FCLauncher.old/app.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"version": "1.0.3",
|
||||
"notes": "Removed test text",
|
||||
"platforms": {
|
||||
"linux-x86_64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVTZlMrWWVKdURJQTZvNXR1WTFXSSs4bm1KbkpTeUhDMG9aeThZVDZEVGRCTlJSbFRGMXpZeFlOV085ZThFL0xNTmZjUmk5MUNWSGVIcUxaZnM4bzk0RjJnRDhGMk82bXdNPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzIwODg5ODQ4CWZpbGU6ZmMtbGF1bmNoZXJfMS4wLjNfYW1kNjQuQXBwSW1hZ2UudGFyLmd6CkViSUNFWmNmZVJiQVR1MTBCUHptc3VxeVV4V3daK0tCUnBPc21GdlBUdlVFMXNLWmFSeUJ4V0ZPN2ZoUXdMRjBzZ3NUTjExSFFVV2QrOGxXQmZKSURRPT0K",
|
||||
"url": "https://gitea.piwalker.net/fclauncher/app/linux/fc-launcher_1.0.3_amd64.AppImage.tar.gz"
|
||||
},
|
||||
"windows-x86_64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVTZlMrWWVKdURJQThTaEpZYjNicThPbVFzbXlwYlJQanBWZGhncEtCVEkvc21SLzcrS0NuZFozdDM5d01lOCtYUElyb0dYQmpPelF0WDF5R1IyN3RZVU1BaDFRWkFneFFJPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzIwODg5NjMwCWZpbGU6RkNMYXVuY2hlcl8xLjAuM194NjRfZW4tVVMubXNpLnppcApTOXQvQlZWV2VYS2ZjYmIwSWJobzIxYjh1TWhyNHlFS21BVU11RVVud3dUQmMzVldUSlh2VURob0s2T3dUM1ZtcHJrZ2VvYXhoZFlZWmJ2OEJmYlpDUT09Cg==",
|
||||
"url": "https://gitea.piwalker.net/fclauncher/app/windows/FCLauncher_1.0.3_x64_en-US.msi.zip"
|
||||
}
|
||||
}
|
||||
}
|
BIN
FCLauncher.old/assets/CityBase.png
Normal file
After Width: | Height: | Size: 367 KiB |
BIN
FCLauncher.old/assets/Title.png
Normal file
After Width: | Height: | Size: 109 KiB |
231
FCLauncher.old/package-lock.json
generated
Normal file
@ -0,0 +1,231 @@
|
||||
{
|
||||
"name": "fclauncher",
|
||||
"version": "0.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "fclauncher",
|
||||
"version": "0.0.0",
|
||||
"devDependencies": {
|
||||
"@tauri-apps/api": "^1.5.6",
|
||||
"@tauri-apps/cli": "^1"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/api": {
|
||||
"version": "1.5.6",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-1.5.6.tgz",
|
||||
"integrity": "sha512-LH5ToovAHnDVe5Qa9f/+jW28I6DeMhos8bNDtBOmmnaDpPmJmYLyHdeDblAWWWYc7KKRDg9/66vMuKyq0WIeFA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"engines": {
|
||||
"node": ">= 14.6.0",
|
||||
"npm": ">= 6.6.0",
|
||||
"yarn": ">= 1.19.1"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/tauri"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli": {
|
||||
"version": "1.5.14",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli/-/cli-1.5.14.tgz",
|
||||
"integrity": "sha512-JOSMKymlg116UdEXSj69eg5p1OtZnQkUE0qIGbtNDO1sk3X/KgBN6+oHBW0BzPStp/W0AjBgrMWCqjHPwEpOug==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"bin": {
|
||||
"tauri": "tauri.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/tauri"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@tauri-apps/cli-darwin-arm64": "1.5.14",
|
||||
"@tauri-apps/cli-darwin-x64": "1.5.14",
|
||||
"@tauri-apps/cli-linux-arm-gnueabihf": "1.5.14",
|
||||
"@tauri-apps/cli-linux-arm64-gnu": "1.5.14",
|
||||
"@tauri-apps/cli-linux-arm64-musl": "1.5.14",
|
||||
"@tauri-apps/cli-linux-x64-gnu": "1.5.14",
|
||||
"@tauri-apps/cli-linux-x64-musl": "1.5.14",
|
||||
"@tauri-apps/cli-win32-arm64-msvc": "1.5.14",
|
||||
"@tauri-apps/cli-win32-ia32-msvc": "1.5.14",
|
||||
"@tauri-apps/cli-win32-x64-msvc": "1.5.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-darwin-arm64": {
|
||||
"version": "1.5.14",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-1.5.14.tgz",
|
||||
"integrity": "sha512-lxoSOp3KKSqzHJa7iT32dukPGMlfsTuja1xXSgwR8o/fqzpYJY7FY/3ZxesP8HR66FcK+vtqa//HNqeOQ0mHkA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-darwin-x64": {
|
||||
"version": "1.5.14",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-1.5.14.tgz",
|
||||
"integrity": "sha512-EXSwN1n5spfG8FoXuyc90ACtmDJXzaZ1gxyENaq9xEpQoo7j/Q1vb6qXxmr6azKr8zmqY4h08ZFbv3exh93xJg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-linux-arm-gnueabihf": {
|
||||
"version": "1.5.14",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-1.5.14.tgz",
|
||||
"integrity": "sha512-Yb8BH/KYR7Tl+de40sZPfrqbhcU3Jlu+UPIrnXt05sjn48xqIps74Xjz8zzVp0TuHxUp8FmIGtCVhQgsbrsvvg==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-linux-arm64-gnu": {
|
||||
"version": "1.5.14",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-1.5.14.tgz",
|
||||
"integrity": "sha512-QrKHP4gRaHiup478rPBZ+BmNd88yze9jMmheoNy9mN1K/aECRmTHO+tWhsxv5moFHZzRhO0QDWxxvTtiaPXaGg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-linux-arm64-musl": {
|
||||
"version": "1.5.14",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.5.14.tgz",
|
||||
"integrity": "sha512-Hb1C1VMxmUcyGjW/K/INKF87zzzgLEVRmWZZnQd7M1P4uue4xPyIwUELSdX12Z2jREPgmLW4AXPD0m6wsNu7iw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-linux-x64-gnu": {
|
||||
"version": "1.5.14",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-1.5.14.tgz",
|
||||
"integrity": "sha512-kD9v/UwPDuhIgq2TJj/s2/7rqk+vmExVV6xHPKI8vVbIvlNAOZqmx3fpxjej1241vhJ/piGd/m6q6YMWGsL0oQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-linux-x64-musl": {
|
||||
"version": "1.5.14",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-1.5.14.tgz",
|
||||
"integrity": "sha512-204Drgg9Zx0+THKndqASz4+iPCwqA3gQVF9C0CDIArNXrjPyJjVvW8VP5CHiZYaTNWxlz/ltyxluM6UFWbXNFw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-win32-arm64-msvc": {
|
||||
"version": "1.5.14",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-1.5.14.tgz",
|
||||
"integrity": "sha512-sqPSni2MnWNCm+8YZnLdWCclxfSHaYqKuPFSz8q7Tn1G1m/cA9gyPoC1G0esHftY7bu/ZM5lB4kM3I4U0KlLiA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-win32-ia32-msvc": {
|
||||
"version": "1.5.14",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-1.5.14.tgz",
|
||||
"integrity": "sha512-8xN8W0zTs8oFsQmvYLxHFeqhzVI7oTaPK1xQMc5gbpFP45jN41c21aCXfjnvzT+h90EfCHUF9EWj2HTEJSb7Iw==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-win32-x64-msvc": {
|
||||
"version": "1.5.14",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-1.5.14.tgz",
|
||||
"integrity": "sha512-U0slee5tNM2PYECBpPHavLSwkT3szGMZ+qhcikQQbDan84bQdLn/kHWjyXOgLJs4KSve4+KxcrN+AVqj0VyHnw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
13
FCLauncher.old/package.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "fclauncher",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/api": "^1.5.6",
|
||||
"@tauri-apps/cli": "^1"
|
||||
}
|
||||
}
|
7
FCLauncher.old/src-tauri/.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
|
||||
# Generated by Tauri
|
||||
# will have schema files for capabilities auto-completion
|
||||
/gen/schemas
|
39
FCLauncher.old/src-tauri/Cargo.toml
Normal file
@ -0,0 +1,39 @@
|
||||
[package]
|
||||
name = "fclauncher"
|
||||
version = "0.0.5"
|
||||
description = "Launcher for Familycraft"
|
||||
authors = ["Samuel Walker", "Benjamin Walker"]
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2", features = [] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
suppaftp = { version = "6.0.1", features = ["native-tls"] }
|
||||
tar = "0.4.41"
|
||||
flate2 = "1.0.30"
|
||||
zip-extract = "0.1.3"
|
||||
dirs = "5.0.1"
|
||||
gethostname = "0.4.3"
|
||||
self_update = "0.40.0"
|
||||
parking_lot = "0.12.3"
|
||||
reqwest = { version = "0.12.5", features = ["stream"] }
|
||||
futures-util = "0.3.30"
|
||||
ssh2 = "0.9.4"
|
||||
chrono = "0.4.38"
|
||||
zip = "2.1.3"
|
||||
tauri-plugin-dialog = "2"
|
||||
tauri-plugin-shell = "2"
|
||||
tauri-plugin-process = "2"
|
||||
|
||||
[features]
|
||||
# This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!!
|
||||
custom-protocol = ["tauri/custom-protocol"]
|
||||
|
||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||
tauri-plugin-updater = "2"
|
3
FCLauncher.old/src-tauri/build.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
tauri_build::build()
|
||||
}
|
4
FCLauncher.old/src-tauri/build.sh
Executable file
@ -0,0 +1,4 @@
|
||||
export TAURI_PRIVATE_KEY=$(cat ~/.tauri/fclauncher.key)
|
||||
read -s PASSWORD
|
||||
export TAURI_KEY_PASSWORD=$PASSWORD
|
||||
NO_STRIP=true cargo tauri build
|
11
FCLauncher.old/src-tauri/capabilities/desktop.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"identifier": "desktop-capability",
|
||||
"platforms": [
|
||||
"macOS",
|
||||
"windows",
|
||||
"linux"
|
||||
],
|
||||
"permissions": [
|
||||
"updater:default"
|
||||
]
|
||||
}
|
20
FCLauncher.old/src-tauri/capabilities/migrated.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"identifier": "migrated",
|
||||
"description": "permissions that were migrated from v1",
|
||||
"local": true,
|
||||
"windows": [
|
||||
"main"
|
||||
],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"shell:allow-open",
|
||||
"dialog:allow-open",
|
||||
"dialog:allow-message",
|
||||
"dialog:allow-ask",
|
||||
"process:allow-restart",
|
||||
"process:allow-exit",
|
||||
"dialog:default",
|
||||
"shell:default",
|
||||
"process:default"
|
||||
]
|
||||
}
|
BIN
FCLauncher.old/src-tauri/icons/128x128.png
Normal file
After Width: | Height: | Size: 9.9 KiB |
BIN
FCLauncher.old/src-tauri/icons/128x128@2x.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
FCLauncher.old/src-tauri/icons/32x32.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
FCLauncher.old/src-tauri/icons/Square107x107Logo.png
Normal file
After Width: | Height: | Size: 8.0 KiB |
BIN
FCLauncher.old/src-tauri/icons/Square142x142Logo.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
FCLauncher.old/src-tauri/icons/Square150x150Logo.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
FCLauncher.old/src-tauri/icons/Square284x284Logo.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
FCLauncher.old/src-tauri/icons/Square30x30Logo.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
FCLauncher.old/src-tauri/icons/Square310x310Logo.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
FCLauncher.old/src-tauri/icons/Square44x44Logo.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
FCLauncher.old/src-tauri/icons/Square71x71Logo.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
FCLauncher.old/src-tauri/icons/Square89x89Logo.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
FCLauncher.old/src-tauri/icons/StoreLogo.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
FCLauncher.old/src-tauri/icons/icon.icns
Normal file
BIN
FCLauncher.old/src-tauri/icons/icon.ico
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
FCLauncher.old/src-tauri/icons/icon.png
Normal file
After Width: | Height: | Size: 53 KiB |
24
FCLauncher.old/src-tauri/res/vsftpd.crt
Normal file
@ -0,0 +1,24 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIID8TCCAtmgAwIBAgIUeFYZmMrAiIFZ9/QFwUS636XZrJMwDQYJKoZIhvcNAQEL
|
||||
BQAwgYcxCzAJBgNVBAYTAlVTMRAwDgYDVQQIDAdXeW9taW5nMREwDwYDVQQHDAhD
|
||||
aGV5ZW5uZTERMA8GA1UECgwIUGVyc29uYWwxGzAZBgNVBAMMEmdpdGVhLnBpd2Fs
|
||||
a2VyLm5ldDEjMCEGCSqGSIb3DQEJARYUc3dhbGtlckBwaXdhbGtlci5uZXQwHhcN
|
||||
MjQwNjIyMDAzNzEwWhcNMjUwNjIyMDAzNzEwWjCBhzELMAkGA1UEBhMCVVMxEDAO
|
||||
BgNVBAgMB1d5b21pbmcxETAPBgNVBAcMCENoZXllbm5lMREwDwYDVQQKDAhQZXJz
|
||||
b25hbDEbMBkGA1UEAwwSZ2l0ZWEucGl3YWxrZXIubmV0MSMwIQYJKoZIhvcNAQkB
|
||||
FhRzd2Fsa2VyQHBpd2Fsa2VyLm5ldDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
|
||||
AQoCggEBANOo7BOAUKhbBWodZqY8U34sQhK5Zj6WkVPQrFG1MWXX3KarDtBSuZ99
|
||||
PjbIoDR+Xm5MuNcJMnbeG4+EH6SrNsogHoyn7m8XJAQ/1N6kHEii4qeDzMIbcNu6
|
||||
7L54ZbONBw1Sygilnavp1iPY/2GzWH5ynaT4w4hQQrmDm8GlDNjxWGnw1CpOExAs
|
||||
LdUP3sF6RNtN6dX1vgYMo9ziNtRazRmDANXykgrfBrPCyjUGDsI9wnqm21qoaQ/s
|
||||
w506XovYI1Q6zWVu6cWUYyCFy4mABQxOOf7doJi4h6Wbxfp4WbNdcoBDHDN4nHzo
|
||||
pdrMzJ8GlZD0aCmmU+8ERvIk+IXY6+kCAwEAAaNTMFEwHQYDVR0OBBYEFJ/4/N4x
|
||||
fO/5nu/snApQO7Cw6CyCMB8GA1UdIwQYMBaAFJ/4/N4xfO/5nu/snApQO7Cw6CyC
|
||||
MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAMFwno+imd5ApXP4
|
||||
NsuX6db5GLiT6SHV65iactFUbnvqvK35KQMKVW03hOb2FPwAzEPARcPtFlENAWBl
|
||||
mHphDwAmfLbHXHdiTAKJNFO7D/AOB4TG6geBFlhYvwHCVS17nzFRJvF/0APlgbO8
|
||||
8f3XkmPBPudaGiuKHWdppdHCisk6CfYvNNnjguxihyUL/mDkwiKYQPcHsMYwdYM0
|
||||
QWCcTNyCjnFK/pbo6dLyPAFpXE9becSEhbxvFziNelADRflLkOUSd+sfxmoLMMsA
|
||||
EJajfocYQkAOiuh8uVzol9xsnKcZiujRoTSnndZsRVqfiNZaJbpvZoD/kY0aBXHo
|
||||
SIh5Ff4=
|
||||
-----END CERTIFICATE-----
|
47
FCLauncher.old/src-tauri/src/2
Normal file
@ -0,0 +1,47 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::{io::Cursor, path::PathBuf};
|
||||
use std::io::Seek;
|
||||
use serde_json::{Map, Result, Value};
|
||||
|
||||
mod ftp;
|
||||
mod java;
|
||||
mod prism;
|
||||
mod system_dirs;
|
||||
mod util;
|
||||
mod modpack;
|
||||
|
||||
struct ModpackEntry{
|
||||
name: String,
|
||||
id: u8
|
||||
}
|
||||
|
||||
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
|
||||
#[tauri::command]
|
||||
fn greet(name: &str) -> String {
|
||||
format!("Hello, {}! You've been greeted from Rust!", name)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn get_modpacks() -> Vec<ModpackEntry> {
|
||||
let mut buf = Cursor::new(vec![]);
|
||||
ftp::ftp_retr(PathBuf::new().join("modpacks.json"), &mut buf, |_| return);
|
||||
buf.rewind();
|
||||
let v: Value = serde_json::from_reader(buf).unwrap();
|
||||
println!("{}", v[0]["name"]);
|
||||
let mut packs: Vec<ModpackEntry> = Vec::new();
|
||||
for pack in v.as_array().unwrap() {
|
||||
packs.push(ModpackEntry{name: pack["name"].as_str().unwrap().to_string(), id: pack["id"].into()});
|
||||
}
|
||||
return packs;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
prism::install_prism();
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![greet, get_modpacks])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
295
FCLauncher.old/src-tauri/src/admin.rs
Normal file
@ -0,0 +1,295 @@
|
||||
use std::fs::File;
|
||||
use std::io::Cursor;
|
||||
use std::io::Read;
|
||||
use std::io::Seek;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::modpack;
|
||||
use crate::modpack::get_modpacks;
|
||||
use crate::modpack::get_versions;
|
||||
use crate::modpack::VersionEntry;
|
||||
use crate::sftp;
|
||||
use chrono;
|
||||
use serde::Serialize;
|
||||
use ssh2::Session;
|
||||
use zip::write::SimpleFileOptions;
|
||||
use zip::ZipArchive;
|
||||
use zip::ZipWriter;
|
||||
use tauri::Emitter;
|
||||
|
||||
//static USERNAME: parking_lot::Mutex<String> = parking_lot::const_mutex(String::new());
|
||||
//static PASSWORD: parking_lot::Mutex<String> = parking_lot::const_mutex(String::new());
|
||||
static SESSION: tauri::async_runtime::Mutex<Option<Session>> =
|
||||
tauri::async_runtime::Mutex::const_new(None);
|
||||
|
||||
pub fn emit(event: &str, payload: impl Serialize + Clone, window: tauri::AppHandle) {
|
||||
if !window.emit(event, payload).is_ok() {
|
||||
println!("Failed to emit to window!");
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn login(username: String, password: String, window: tauri::AppHandle) {
|
||||
let res = sftp::connect(username, password);
|
||||
if res.is_ok() {
|
||||
//*USERNAME.lock() = username;
|
||||
//*PASSWORD.lock() = password;
|
||||
*SESSION.lock().await = Some(res.unwrap());
|
||||
emit("Login_Success", {}, window);
|
||||
} else {
|
||||
emit("Login_Failed", {}, window);
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn drop_session() {
|
||||
let ref mut session = *SESSION.lock().await;
|
||||
if let Some(session) = session {
|
||||
session.disconnect(None, "disconnecting", None).unwrap();
|
||||
}
|
||||
*session = None;
|
||||
}
|
||||
|
||||
async fn update_modpacks(modpacks: Vec<modpack::ModpackEntry>) -> Result<(), String> {
|
||||
let data = serde_json::to_string(&modpacks).or(Err("Unable to serialize json"))?;
|
||||
let reader = Cursor::new(data.as_bytes());
|
||||
let ref mut session = *SESSION.lock().await;
|
||||
if let Some(session) = session {
|
||||
sftp::uplaod(
|
||||
None,
|
||||
session.clone(),
|
||||
PathBuf::from("/ftp/modpacks.json"),
|
||||
reader,
|
||||
format!("modpacks.json"),
|
||||
data.as_bytes().len(),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
Err(format!("Session doesnt exist?"))
|
||||
}
|
||||
|
||||
async fn update_versions(id: String, versions: Vec<modpack::VersionEntry>) -> Result<(), String> {
|
||||
let data = serde_json::to_string(&versions).or(Err("Unable to serialize json"))?;
|
||||
let reader = Cursor::new(data.as_bytes());
|
||||
let ref mut session = *SESSION.lock().await;
|
||||
if let Some(session) = session {
|
||||
sftp::uplaod(
|
||||
None,
|
||||
session.clone(),
|
||||
PathBuf::from(format!("/ftp/{}/versions.json", id)),
|
||||
reader,
|
||||
format!("modpacks.json"),
|
||||
data.as_bytes().len(),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
Err(format!("Session doesnt exist?"))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn shift_up(id: String, window: tauri::AppHandle) {
|
||||
let mut modpacks = modpack::get_modpacks().await;
|
||||
let mut index = 0;
|
||||
for pack in modpacks.as_slice() {
|
||||
if pack.id == id {
|
||||
break;
|
||||
}
|
||||
index += 1;
|
||||
}
|
||||
if index != 0 {
|
||||
modpacks.swap(index, index - 1);
|
||||
}
|
||||
let res = update_modpacks(modpacks).await;
|
||||
if !res.is_ok() {
|
||||
emit("Error", res.unwrap_err(), window);
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn shift_down(id: String, window: tauri::AppHandle) {
|
||||
let mut modpacks = modpack::get_modpacks().await;
|
||||
let mut index = 0;
|
||||
for pack in modpacks.as_slice() {
|
||||
if pack.id == id {
|
||||
break;
|
||||
}
|
||||
index += 1;
|
||||
}
|
||||
if index != modpacks.len() - 1 {
|
||||
modpacks.swap(index, index + 1);
|
||||
}
|
||||
let res = update_modpacks(modpacks).await;
|
||||
if !res.is_ok() {
|
||||
emit("Error", res.unwrap_err(), window);
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn add_pack(id: String, name: String, window: tauri::AppHandle) {
|
||||
{
|
||||
let ref mut session = *SESSION.lock().await;
|
||||
if let Some(session) = session {
|
||||
let res = sftp::mkdir(session.clone(), PathBuf::from(format!("/ftp/{}", id))).await;
|
||||
if !res.is_ok() {
|
||||
emit("Error", res.unwrap_err(), window.clone());
|
||||
}
|
||||
let res = sftp::mkdir(
|
||||
session.clone(),
|
||||
PathBuf::from(format!("/ftp/{}/Versions", id)),
|
||||
)
|
||||
.await;
|
||||
if !res.is_ok() {
|
||||
emit("Error", res.unwrap_err(), window.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
let versions: Vec<VersionEntry> = Vec::new();
|
||||
let res = update_versions(id.clone(), versions).await;
|
||||
if !res.is_ok() {
|
||||
emit("Error", res.unwrap_err(), window.clone());
|
||||
}
|
||||
let mut modpacks = get_modpacks().await;
|
||||
modpacks.push(modpack::ModpackEntry {
|
||||
id: id,
|
||||
name: name,
|
||||
last_updated: format!("{:?}", chrono::offset::Utc::now()),
|
||||
});
|
||||
let res = update_modpacks(modpacks).await;
|
||||
if !res.is_ok() {
|
||||
emit("Error", res.unwrap_err(), window);
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn remove_pack(id: String, window: tauri::AppHandle) {
|
||||
let mut modpacks = get_modpacks().await;
|
||||
let mut index = 0;
|
||||
for pack in modpacks.clone() {
|
||||
if pack.id == id {
|
||||
modpacks.remove(index);
|
||||
break;
|
||||
}
|
||||
index += 1;
|
||||
}
|
||||
let res = update_modpacks(modpacks).await;
|
||||
if !res.is_ok() {
|
||||
emit("Error", res.unwrap_err(), window);
|
||||
}
|
||||
{
|
||||
let ref mut session = *SESSION.lock().await;
|
||||
if let Some(session) = session {
|
||||
sftp::rmdir(session.clone(), PathBuf::from(format!("/ftp/{}", id))).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn update_pack(
|
||||
window: tauri::AppHandle,
|
||||
id: String,
|
||||
path: String,
|
||||
version: String,
|
||||
) -> Result<(), String> {
|
||||
println!(
|
||||
"Update modpack {}, to version {}, from file {}",
|
||||
id, version, path
|
||||
);
|
||||
let file = File::open(Path::new(path.as_str())).or(Err(format!("Unable to open file")))?;
|
||||
let mut archive = ZipArchive::new(file).or(Err(format!("File not a zip archive!")))?;
|
||||
let mut buf = Cursor::new(vec![]);
|
||||
let mut out_archive = ZipWriter::new(&mut buf);
|
||||
|
||||
for i in 0..archive.len() {
|
||||
let mut file = archive
|
||||
.by_index(i)
|
||||
.or(Err(format!("error reading archive")))?;
|
||||
if file.name() == "overrides/version.txt" {
|
||||
continue;
|
||||
}
|
||||
let res = out_archive.start_file(
|
||||
file.name(),
|
||||
SimpleFileOptions::default().compression_method(zip::CompressionMethod::Deflated),
|
||||
);
|
||||
if !res.is_ok() {
|
||||
emit("Error", format!("Unable to start zip archive"), window);
|
||||
return Err(format!("Unable to start zip archive"));
|
||||
}
|
||||
let res = std::io::copy(&mut file, &mut out_archive);
|
||||
if !res.is_ok() {
|
||||
emit("Error", format!("Unable to copy archive to ram"), window);
|
||||
return Err(format!("Unable to copy archive to ram"));
|
||||
}
|
||||
}
|
||||
let res = out_archive.start_file(
|
||||
"overrides/version.txt",
|
||||
SimpleFileOptions::default().compression_method(zip::CompressionMethod::Deflated),
|
||||
);
|
||||
if !res.is_ok() {
|
||||
emit("Error", format!("Unable to create version file"), window);
|
||||
return Err(format!("Unable to create version file"));
|
||||
}
|
||||
let res = out_archive.write_all(version.as_bytes());
|
||||
if !res.is_ok() {
|
||||
emit("Error", format!("Unable to write to zip"), window);
|
||||
return Err(format!("Unable to write to zip"));
|
||||
}
|
||||
let res = out_archive.finish();
|
||||
if !res.is_ok() {
|
||||
emit("Error", format!("Unable to finish zip"), window);
|
||||
return Err(format!("Unable to finish zip"));
|
||||
}
|
||||
buf.rewind().unwrap();
|
||||
let timestamp = format!("{:?}", chrono::offset::Utc::now());
|
||||
let path = format!("Versions/{}-{}.mrpack", id, timestamp);
|
||||
{
|
||||
let ref mut session = *SESSION.lock().await;
|
||||
if let Some(session) = session {
|
||||
let size = buf.clone().bytes().count();
|
||||
let upload_path = format!("/ftp/{}/{}", id, path.clone());
|
||||
println!("Uploading to {}", upload_path);
|
||||
let res = sftp::uplaod(
|
||||
Some(window.clone()),
|
||||
session.clone(),
|
||||
PathBuf::from(upload_path),
|
||||
&mut buf,
|
||||
path.clone(),
|
||||
size,
|
||||
)
|
||||
.await;
|
||||
if !res.is_ok() {
|
||||
emit("Error", res.clone().unwrap_err(), window.clone());
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let mut versions = get_versions(id.clone()).await?;
|
||||
versions.push(VersionEntry {
|
||||
Version: version,
|
||||
Date: timestamp.clone(),
|
||||
File: path,
|
||||
});
|
||||
let res = update_versions(id.clone(), versions).await;
|
||||
if !res.is_ok() {
|
||||
emit("Error", res.clone().unwrap_err(), window.clone());
|
||||
return res;
|
||||
}
|
||||
let mut modpacks = get_modpacks().await;
|
||||
let mut index = 0;
|
||||
for pack in modpacks.as_slice() {
|
||||
if pack.id == id {
|
||||
modpacks[index].last_updated = timestamp;
|
||||
break;
|
||||
}
|
||||
index += 1;
|
||||
}
|
||||
let res = update_modpacks(modpacks).await;
|
||||
if !res.is_ok() {
|
||||
emit("Error", res.clone().unwrap_err(), window.clone());
|
||||
return res;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
62
FCLauncher.old/src-tauri/src/ftp.rs
Normal file
@ -0,0 +1,62 @@
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use suppaftp::FtpError;
|
||||
use suppaftp::NativeTlsFtpStream;
|
||||
use suppaftp::NativeTlsConnector;
|
||||
use suppaftp::native_tls::Certificate;
|
||||
use suppaftp::native_tls::TlsConnector;
|
||||
|
||||
|
||||
fn ftp_connection_anonymous() -> Result<NativeTlsFtpStream, FtpError>{
|
||||
ftp_connection("anonymous", "anonymous@")
|
||||
}
|
||||
|
||||
pub fn test_cred(username: &str, password: &str) -> bool{
|
||||
return ftp_connection(username, password).is_ok();
|
||||
}
|
||||
|
||||
|
||||
fn ftp_connection(username: &str, password: &str) -> Result<NativeTlsFtpStream, FtpError>{
|
||||
let ftp_stream = NativeTlsFtpStream::connect("gitea.piwalker.net:21")?;
|
||||
let cert = include_bytes!("../res/vsftpd.crt");
|
||||
let cert = Certificate::from_pem(cert).unwrap();
|
||||
let mut ftp_stream = ftp_stream.into_secure(NativeTlsConnector::from(TlsConnector::builder().add_root_certificate(cert).build().unwrap()), "gitea.piwalker.net").unwrap();
|
||||
let result = ftp_stream.login(username, password);
|
||||
if result.is_ok() {
|
||||
return Ok(ftp_stream);
|
||||
}
|
||||
Err(result.unwrap_err())
|
||||
}
|
||||
|
||||
pub fn ftp_retr(window: Option<tauri::Window>, file: PathBuf , mut writer: impl Write, mut callback: impl FnMut(Option<tauri::Window>, usize, usize)) -> Result<bool, FtpError> {
|
||||
let mut ftp_stream = ftp_connection_anonymous()?;
|
||||
let file = file.to_str().unwrap().replace("\\", "/");
|
||||
let size = ftp_stream.size(&file)?;
|
||||
let mut total = 0;
|
||||
ftp_stream.retr(file.as_str(), |stream| {
|
||||
let mut tx_bytes = [0u8; 1500];
|
||||
loop {
|
||||
let bytes_read = stream.read(&mut tx_bytes).unwrap();
|
||||
writer.write_all(&mut tx_bytes.split_at(bytes_read).0).unwrap();
|
||||
total += bytes_read;
|
||||
if total == size || bytes_read == 0 {
|
||||
callback(window.clone(), 0, size);
|
||||
break;
|
||||
}else{
|
||||
callback(window.clone(), bytes_read, size);
|
||||
}
|
||||
}
|
||||
Ok(true)
|
||||
})?;
|
||||
Ok(true)
|
||||
|
||||
}
|
||||
|
||||
pub fn ftp_get_size(file: PathBuf) -> Result<usize, FtpError> {
|
||||
let mut stream = ftp_connection_anonymous()?;
|
||||
stream.size(file.to_str().unwrap().replace("\\", "/"))
|
||||
}
|
||||
|
||||
|
||||
|
67
FCLauncher.old/src-tauri/src/https.rs
Normal file
@ -0,0 +1,67 @@
|
||||
use futures_util::StreamExt;
|
||||
use serde::Serialize;
|
||||
use std::cmp::min;
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
use tauri::Emitter;
|
||||
|
||||
#[derive(Clone, Serialize)]
|
||||
pub struct DownloadStatus {
|
||||
pub downloaded: usize,
|
||||
pub total: usize,
|
||||
pub time_elapsed: usize,
|
||||
pub download_name: String,
|
||||
}
|
||||
|
||||
pub async fn download(
|
||||
window: Option<tauri::AppHandle>,
|
||||
url: String,
|
||||
mut writer: impl Write,
|
||||
downloadName: String,
|
||||
) -> Result<(), String> {
|
||||
let client = reqwest::Client::new();
|
||||
let res = client
|
||||
.get(url)
|
||||
.send()
|
||||
.await
|
||||
.or(Err(format!("Failed to fetch from URL!")))?;
|
||||
let total_size = res
|
||||
.content_length()
|
||||
.ok_or(format!("Failed to get content length"))?;
|
||||
let mut downloaded: u64 = 0;
|
||||
let mut stream = res.bytes_stream();
|
||||
while let Some(item) = stream.next().await {
|
||||
let chunk = item.or(Err(format!("Error while downloading file!")))?;
|
||||
writer
|
||||
.write_all(&chunk)
|
||||
.or(Err("Error writing to stream!"))?;
|
||||
let new = min(downloaded + (chunk.len() as u64), total_size);
|
||||
downloaded = new;
|
||||
println!(
|
||||
"Downloading {}: {}MB / {}MB",
|
||||
downloadName.clone(),
|
||||
downloaded / (1024 * 1024),
|
||||
total_size / (1024 * 1024)
|
||||
);
|
||||
if let Some(window) = window.clone() {
|
||||
if downloaded != total_size {
|
||||
window
|
||||
.emit(
|
||||
"download_progress",
|
||||
DownloadStatus {
|
||||
downloaded: downloaded as usize,
|
||||
total: total_size as usize,
|
||||
time_elapsed: 0,
|
||||
download_name: downloadName.clone(),
|
||||
},
|
||||
)
|
||||
.or(Err(format!("Unable to signal window")))?;
|
||||
} else {
|
||||
window
|
||||
.emit("download_finished", true)
|
||||
.or(Err(format!("Unable to signal window!")))?;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Ok(());
|
||||
}
|
110
FCLauncher.old/src-tauri/src/java.rs
Normal file
@ -0,0 +1,110 @@
|
||||
use flate2::read::GzDecoder;
|
||||
use std::env;
|
||||
use std::io::{Cursor, Read, Seek};
|
||||
use std::path::{Components, Path, PathBuf};
|
||||
use tar::Archive;
|
||||
|
||||
use crate::https;
|
||||
use crate::system_dirs::get_local_data_directory;
|
||||
use crate::util;
|
||||
|
||||
fn check_java(version: u8) -> bool {
|
||||
let dir = get_local_data_directory().join("java").join(format!(
|
||||
"java-{}-{}",
|
||||
version,
|
||||
if env::consts::OS == "windows" {
|
||||
"win"
|
||||
} else {
|
||||
"lin"
|
||||
}
|
||||
));
|
||||
dir.exists()
|
||||
}
|
||||
|
||||
pub async fn install_java(version: u8, window: tauri::AppHandle) {
|
||||
if check_java(version) {
|
||||
return;
|
||||
}
|
||||
//let ftp_dir = PathBuf::new().join("java").join(format!("java-{}-{}", version, if env::consts::OS == "windows" { "win.zip" } else {"lin.tar.gz"}));
|
||||
let mut buff = Cursor::new(vec![]);
|
||||
//ftp::ftp_retr(Some(window), ftp_dir, &mut buff, |window, data, size| util::download_callback(format!("Java {}", version), window,data, size)).unwrap();
|
||||
https::download(
|
||||
Some(window.clone()),
|
||||
format!(
|
||||
"https://gitea.piwalker.net/fclauncher/java/java-{}-{}",
|
||||
version,
|
||||
if env::consts::OS == "windows" {
|
||||
"win.zip"
|
||||
} else {
|
||||
"lin.tar.gz"
|
||||
}
|
||||
),
|
||||
&mut buff,
|
||||
format!("Java {}", version),
|
||||
)
|
||||
.await;
|
||||
std::fs::create_dir_all(get_local_data_directory().join("java").join(format!(
|
||||
"java-{}-{}",
|
||||
version,
|
||||
if env::consts::OS == "windows" {
|
||||
"win"
|
||||
} else {
|
||||
"lin"
|
||||
}
|
||||
)))
|
||||
.unwrap();
|
||||
buff.rewind().unwrap();
|
||||
if env::consts::OS != "windows" {
|
||||
let tar = GzDecoder::new(buff);
|
||||
let mut archive = Archive::new(tar);
|
||||
if !unpack_archive(
|
||||
archive,
|
||||
get_local_data_directory()
|
||||
.join("java")
|
||||
.join(format!("java-{}-lin", version)),
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
std::fs::remove_dir_all(
|
||||
get_local_data_directory()
|
||||
.join("java")
|
||||
.join(format!("java-{}-lin", version)),
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
} else {
|
||||
if !zip_extract::extract(
|
||||
buff,
|
||||
get_local_data_directory()
|
||||
.join("java")
|
||||
.join(format!("java-{}-win", version))
|
||||
.as_path(),
|
||||
true,
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
std::fs::remove_dir_all(
|
||||
get_local_data_directory()
|
||||
.join("java")
|
||||
.join(format!("java-{}-win", version)),
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn unpack_archive<T: Read>(
|
||||
mut archive: Archive<T>,
|
||||
dst: PathBuf,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
for file in archive.entries()? {
|
||||
let path = PathBuf::new().join(dst.clone());
|
||||
let mut file = file?;
|
||||
let file_path = file.path()?;
|
||||
let mut file_path = file_path.components();
|
||||
let _ = file_path.next();
|
||||
let file_path = file_path.as_path();
|
||||
file.unpack(path.join(file_path))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
60
FCLauncher.old/src-tauri/src/main.rs
Normal file
@ -0,0 +1,60 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use self_update::cargo_crate_version;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde_json::{Map, Result, Value};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::io::Seek;
|
||||
use std::{io::Cursor, path::PathBuf};
|
||||
|
||||
//mod ftp;
|
||||
mod admin;
|
||||
mod https;
|
||||
mod java;
|
||||
mod modpack;
|
||||
mod prism;
|
||||
mod sftp;
|
||||
mod system_dirs;
|
||||
mod util;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct ModpackEntry {
|
||||
name: String,
|
||||
id: String,
|
||||
}
|
||||
|
||||
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
|
||||
#[tauri::command]
|
||||
fn greet(name: &str) -> String {
|
||||
format!("Hello, {}! You've been greeted from Rust!", name)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
//modpack::get_modpacks();
|
||||
//prism::install_prism();
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_updater::Builder::new().build())
|
||||
.plugin(tauri_plugin_process::init())
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
greet,
|
||||
modpack::get_modpacks,
|
||||
modpack::launch_modpack,
|
||||
modpack::get_versions,
|
||||
modpack::get_latest_version,
|
||||
prism::launch_prism,
|
||||
prism::install_prism,
|
||||
admin::login,
|
||||
admin::drop_session,
|
||||
admin::shift_up,
|
||||
admin::shift_down,
|
||||
admin::add_pack,
|
||||
admin::remove_pack,
|
||||
admin::update_pack
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
324
FCLauncher.old/src-tauri/src/modpack.rs
Normal file
@ -0,0 +1,324 @@
|
||||
use crate::https;
|
||||
use crate::java;
|
||||
use crate::system_dirs::{
|
||||
get_data_directory, get_java_executable, get_local_data_directory, get_prism_executable,
|
||||
};
|
||||
use crate::util;
|
||||
use reqwest::IntoUrl;
|
||||
use serde::de::value::Error;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde_json::Value;
|
||||
use std::fs;
|
||||
use std::fs::File;
|
||||
use std::io::{Read, Seek, Write};
|
||||
use std::process::Command;
|
||||
use std::time::Duration;
|
||||
use std::{env, thread};
|
||||
use std::{io::Cursor, path::PathBuf};
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct ModpackEntry {
|
||||
pub name: String,
|
||||
pub id: String,
|
||||
pub last_updated: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct VersionEntry {
|
||||
pub Version: String,
|
||||
pub File: String,
|
||||
pub Date: String,
|
||||
}
|
||||
|
||||
async fn get_modpack_name(id: String) -> String {
|
||||
let modpacks = get_modpacks().await;
|
||||
let mut instance_name = String::new();
|
||||
for pack in modpacks {
|
||||
if pack.id == id {
|
||||
instance_name = pack.name;
|
||||
}
|
||||
}
|
||||
return instance_name;
|
||||
}
|
||||
|
||||
async fn check_modpack_needs_update(id: String) -> bool {
|
||||
let mut instance_name = get_modpack_name(id.clone()).await;
|
||||
if !get_local_data_directory()
|
||||
.join("prism")
|
||||
.join("instances")
|
||||
.join(&mut instance_name)
|
||||
.exists()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
let versions = get_versions(id).await;
|
||||
if !versions.is_ok() {
|
||||
return false;
|
||||
}
|
||||
let versions = versions.unwrap();
|
||||
let latest = versions[versions.len() - 1].Version.clone();
|
||||
|
||||
let mut file = File::open(
|
||||
get_local_data_directory()
|
||||
.join("prism")
|
||||
.join("instances")
|
||||
.join(instance_name)
|
||||
.join(".minecraft")
|
||||
.join("version.txt"),
|
||||
)
|
||||
.unwrap();
|
||||
let mut current = String::new();
|
||||
file.read_to_string(&mut current);
|
||||
|
||||
if latest != current {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn launch_modpack(window: tauri::AppHandle, id: String) {
|
||||
if check_modpack_needs_update(id.clone()).await {
|
||||
install_modpack(window, id.clone()).await;
|
||||
}
|
||||
// Launch
|
||||
let mut child = Command::new(
|
||||
get_local_data_directory()
|
||||
.join("prism")
|
||||
.join(get_prism_executable()),
|
||||
)
|
||||
.arg("-l")
|
||||
.arg(get_modpack_name(id).await)
|
||||
.spawn()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
async fn install_modpack(window: tauri::AppHandle, id: String) {
|
||||
let versions = get_versions(id.clone()).await.unwrap();
|
||||
let path = env::temp_dir().join(format!("{}.mrpack", get_modpack_name(id.clone()).await));
|
||||
let mut file = File::create(path.clone()).unwrap();
|
||||
let ftp_path = PathBuf::new()
|
||||
.join(id.clone())
|
||||
.join(versions[versions.len() - 1].File.clone().as_str());
|
||||
println!("Downloading file {}", ftp_path.to_str().unwrap());
|
||||
//ftp::ftp_retr(Some(window.clone()), ftp_path, &mut file, |window, data, size| util::download_callback(name.clone(), window, data, size)).unwrap();
|
||||
https::download(
|
||||
Some(window.clone()),
|
||||
format!(
|
||||
"https://gitea.piwalker.net/fclauncher/{}/{}",
|
||||
id.clone(),
|
||||
versions[versions.len() - 1].File.clone()
|
||||
),
|
||||
&mut file,
|
||||
get_modpack_name(id.clone()).await,
|
||||
)
|
||||
.await;
|
||||
let mut child = Command::new(
|
||||
get_local_data_directory()
|
||||
.join("prism")
|
||||
.join(get_prism_executable()),
|
||||
)
|
||||
.arg("-I")
|
||||
.arg(path)
|
||||
.spawn()
|
||||
.unwrap();
|
||||
loop {
|
||||
let version_path = get_local_data_directory()
|
||||
.join("prism")
|
||||
.join("instances")
|
||||
.join(get_modpack_name(id.clone()).await)
|
||||
.join(".minecraft")
|
||||
.join("version.txt");
|
||||
if version_path.clone().exists() {
|
||||
let mut ver_file = File::open(version_path).unwrap();
|
||||
let mut buf = String::new();
|
||||
ver_file.read_to_string(&mut buf).unwrap();
|
||||
if buf == versions[versions.len() - 1].Version.clone().as_str() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
thread::sleep(Duration::from_secs(3));
|
||||
}
|
||||
thread::sleep(Duration::from_secs(1));
|
||||
child.kill();
|
||||
let info_path = get_local_data_directory()
|
||||
.join("prism")
|
||||
.join("instances")
|
||||
.join(get_modpack_name(id.clone()).await)
|
||||
.join("mmc-pack.json");
|
||||
let mut info_file = File::open(info_path.clone()).unwrap();
|
||||
let info_json: Value = serde_json::from_reader(info_file).unwrap();
|
||||
let mut mc_version = "0.0";
|
||||
for component in info_json["components"].as_array().unwrap() {
|
||||
if component["uid"] == "net.minecraft" {
|
||||
mc_version = component["version"].as_str().unwrap();
|
||||
}
|
||||
}
|
||||
let java = get_java_version(mc_version);
|
||||
java::install_java(java, window.clone()).await;
|
||||
|
||||
let option_path = get_local_data_directory()
|
||||
.join("prism")
|
||||
.join("instances")
|
||||
.join(get_modpack_name(id.clone()).await)
|
||||
.join("instance.cfg");
|
||||
let mut option_file = File::open(option_path.clone()).unwrap();
|
||||
let mut buf = String::new();
|
||||
option_file.read_to_string(&mut buf);
|
||||
let mut option_file = File::create(option_path).unwrap();
|
||||
let mut set = false;
|
||||
for line in buf.lines() {
|
||||
if line.starts_with("JavaPath=") {
|
||||
option_file.write_all(
|
||||
format!(
|
||||
"JavaPath={}/java-{}-{}/bin/{}\n",
|
||||
get_local_data_directory()
|
||||
.join("java")
|
||||
.into_os_string()
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.replace("\\", "/"),
|
||||
java,
|
||||
if env::consts::OS == "windows" {
|
||||
"win"
|
||||
} else {
|
||||
"lin"
|
||||
},
|
||||
get_java_executable()
|
||||
)
|
||||
.as_bytes(),
|
||||
);
|
||||
set = true;
|
||||
} else {
|
||||
option_file.write_all(format!("{}\n", line).as_bytes());
|
||||
}
|
||||
}
|
||||
if !set {
|
||||
option_file.write_all(
|
||||
format!(
|
||||
"JavaPath={}/java-{}-{}/bin/{}\n",
|
||||
get_local_data_directory()
|
||||
.join("java")
|
||||
.into_os_string()
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.replace("\\", "/"),
|
||||
java,
|
||||
if env::consts::OS == "windows" {
|
||||
"win"
|
||||
} else {
|
||||
"lin"
|
||||
},
|
||||
get_java_executable()
|
||||
)
|
||||
.as_bytes(),
|
||||
);
|
||||
option_file.write_all("OverrideJavaLocation=true\n".as_bytes());
|
||||
option_file.write_all("OverrideJava=true\n".as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_modpacks() -> Vec<ModpackEntry> {
|
||||
//unsafe{
|
||||
let mut modpacks: Vec<ModpackEntry> = Vec::new();
|
||||
//if modpacks.is_empty() {
|
||||
let mut buf = Cursor::new(vec![]);
|
||||
//ftp::ftp_retr(None, PathBuf::new().join("modpacks.json"), &mut buf, |_, _, _| return);
|
||||
https::download(
|
||||
None,
|
||||
format!("https://gitea.piwalker.net/fclauncher/modpacks.json"),
|
||||
&mut buf,
|
||||
format!("modpacks.json"),
|
||||
)
|
||||
.await;
|
||||
buf.rewind();
|
||||
let res = serde_json::from_reader(buf);
|
||||
if !res.is_ok() {
|
||||
println!("Result not ok!");
|
||||
let paths =
|
||||
fs::read_dir(get_local_data_directory().join("prism").join("instances")).unwrap();
|
||||
for path in paths {
|
||||
let path = path.unwrap();
|
||||
if fs::metadata(path.path()).unwrap().is_file() {
|
||||
continue;
|
||||
}
|
||||
let name = path.file_name().into_string().unwrap();
|
||||
if name.starts_with(".") {
|
||||
continue;
|
||||
}
|
||||
|
||||
modpacks.push(ModpackEntry {
|
||||
name: name.clone(),
|
||||
id: name,
|
||||
last_updated: format!(""),
|
||||
})
|
||||
}
|
||||
return modpacks.clone();
|
||||
}
|
||||
let modpacks: Vec<ModpackEntry> = res.unwrap();
|
||||
//println!("{}", v[0].name);
|
||||
//for pack in v.as_array().unwrap() {
|
||||
//modpacks.push(ModpackEntry{name: pack["name"].as_str().unwrap().to_string(), id: pack["id"].as_str().unwrap().to_string(), last_updated: pack["last-updated"].as_str().unwrap().to_string()});
|
||||
//}
|
||||
//}
|
||||
return modpacks.clone();
|
||||
//}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_versions(id: String) -> Result<Vec<VersionEntry>, String> {
|
||||
let mut versions: Vec<VersionEntry> = Vec::new();
|
||||
let mut buf = Cursor::new(vec![]);
|
||||
//ftp::ftp_retr(None, PathBuf::new().join(id).join("versions.json"), &mut buf, |_, _, _| return);
|
||||
https::download(
|
||||
None,
|
||||
format!(
|
||||
"https://gitea.piwalker.net/fclauncher/{}/versions.json",
|
||||
id.clone()
|
||||
),
|
||||
&mut buf,
|
||||
format!("{}/versions.json", id.clone()),
|
||||
)
|
||||
.await;
|
||||
buf.rewind();
|
||||
let versions: Vec<VersionEntry> =
|
||||
serde_json::from_reader(buf).or(Err(format!("Unable to parse json")))?;
|
||||
//for version in v.as_array().unwrap() {
|
||||
//versions.push(VersionEntry{version: version["Version"].as_str().unwrap().to_string(), file: version["File"].as_str().unwrap().to_string(), date: version["Date"].as_str().unwrap().to_string()});
|
||||
//}
|
||||
return Ok(versions.clone());
|
||||
}
|
||||
|
||||
fn get_java_version(mc_version: &str) -> u8 {
|
||||
let components: Vec<&str> = mc_version.split(".").collect();
|
||||
let mut java = 8;
|
||||
if components[1] == "17" {
|
||||
java = 17
|
||||
} else if components[1] == "18" || components[1] == "19" {
|
||||
java = 17
|
||||
} else if components[1].parse::<i32>().unwrap() > 19 {
|
||||
if components[1] == "20" && components[1].parse::<i32>().unwrap() < 5 {
|
||||
java = 17
|
||||
} else {
|
||||
java = 21
|
||||
}
|
||||
}
|
||||
return java;
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_latest_version(id: String) -> Result<String, String> {
|
||||
let versions = get_versions(id).await.unwrap();
|
||||
if (versions.len() == 0) {
|
||||
return Ok(format!(""));
|
||||
}
|
||||
Ok(versions[versions.len() - 1].Version.clone())
|
||||
}
|
||||
|
||||
//pub fn create_json(modpacks: Vec<ModpackEntry>) -> Result<serde_json::Value, String> {
|
||||
|
||||
//}
|
124
FCLauncher.old/src-tauri/src/prism.rs
Normal file
@ -0,0 +1,124 @@
|
||||
use flate2::read::GzDecoder;
|
||||
use std::{
|
||||
env,
|
||||
fs::File,
|
||||
io::{BufRead, Cursor, Seek, Write},
|
||||
path::PathBuf,
|
||||
process::Command,
|
||||
str::FromStr,
|
||||
};
|
||||
use tar::Archive;
|
||||
//use tauri::file;
|
||||
|
||||
use crate::{
|
||||
https, java,
|
||||
system_dirs::{get_local_data_directory, get_prism_executable},
|
||||
util,
|
||||
};
|
||||
|
||||
pub fn check_prism() -> bool {
|
||||
let path = get_local_data_directory().join("prism");
|
||||
path.exists()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn install_prism(window: tauri::AppHandle) {
|
||||
if check_prism() {
|
||||
return;
|
||||
}
|
||||
java::install_java(21, window.clone()).await;
|
||||
let mut buff = Cursor::new(vec![]);
|
||||
let mut total = 0;
|
||||
//ftp::ftp_retr(Some(window.clone()), path, &mut buff, |window: Option<tauri::Window>, data, size| util::download_callback("Prism Launcher".to_string(),window, data, size)).unwrap();
|
||||
https::download(
|
||||
Some(window.clone()),
|
||||
format!(
|
||||
"https://gitea.piwalker.net/fclauncher/prism/prism-{}",
|
||||
if env::consts::OS == "windows" {
|
||||
"win.zip"
|
||||
} else {
|
||||
"lin.tar.gz"
|
||||
}
|
||||
),
|
||||
&mut buff,
|
||||
format!("Prism Launcher"),
|
||||
)
|
||||
.await;
|
||||
std::fs::create_dir_all(get_local_data_directory().join("prism")).unwrap();
|
||||
buff.rewind().unwrap();
|
||||
if env::consts::OS != "windows" {
|
||||
let tar = GzDecoder::new(buff);
|
||||
let mut archive = Archive::new(tar);
|
||||
if !archive
|
||||
.unpack(get_local_data_directory().join("prism"))
|
||||
.is_ok()
|
||||
{
|
||||
std::fs::remove_dir_all(get_local_data_directory().join("prism"));
|
||||
}
|
||||
} else {
|
||||
if !zip_extract::extract(
|
||||
buff,
|
||||
get_local_data_directory().join("prism").as_path(),
|
||||
true,
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
std::fs::remove_dir_all(get_local_data_directory().join("prism"));
|
||||
}
|
||||
}
|
||||
|
||||
let mut buff = Cursor::new(vec![]);
|
||||
//ftp::ftp_retr(Some(window.clone()), PathBuf::new().join("prism").join("prismlauncher.cfg"), &mut buff, |_, _, _| return).unwrap();
|
||||
https::download(
|
||||
None,
|
||||
format!("https://gitea.piwalker.net/fclauncher/prism/prismlauncher.cfg"),
|
||||
&mut buff,
|
||||
format!("prismlauncher.cfg"),
|
||||
)
|
||||
.await;
|
||||
buff.rewind();
|
||||
let mut file = File::create(
|
||||
get_local_data_directory()
|
||||
.join("prism")
|
||||
.join("prismlauncher.cfg"),
|
||||
)
|
||||
.unwrap();
|
||||
loop {
|
||||
let mut buf = String::new();
|
||||
let count = buff.read_line(&mut buf).unwrap();
|
||||
if count == 0 {
|
||||
break;
|
||||
}
|
||||
if buf.starts_with("JavaPath") {
|
||||
buf = format!(
|
||||
"JavaPath={}/java/java-21-{}\n",
|
||||
get_local_data_directory()
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.replace("\\", "/"),
|
||||
if env::consts::OS == "windows" {
|
||||
"win"
|
||||
} else {
|
||||
"lin"
|
||||
}
|
||||
);
|
||||
} else if buf.starts_with("LastHostname") {
|
||||
buf = format!(
|
||||
"LastHostname={}\n",
|
||||
gethostname::gethostname().to_str().unwrap()
|
||||
);
|
||||
}
|
||||
file.write_all(buf.as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn launch_prism() {
|
||||
let mut child = Command::new(
|
||||
get_local_data_directory()
|
||||
.join("prism")
|
||||
.join(get_prism_executable()),
|
||||
)
|
||||
.spawn()
|
||||
.unwrap();
|
||||
}
|
102
FCLauncher.old/src-tauri/src/sftp.rs
Normal file
@ -0,0 +1,102 @@
|
||||
use futures_util::future::BoxFuture;
|
||||
use futures_util::io::BufReader;
|
||||
use futures_util::io::Cursor;
|
||||
use futures_util::FutureExt;
|
||||
use ssh2::OpenFlags;
|
||||
use ssh2::Session;
|
||||
use ssh2::Sftp;
|
||||
use std::io::prelude::*;
|
||||
use std::net::TcpStream;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use tauri::Emitter;
|
||||
|
||||
use crate::https;
|
||||
|
||||
pub fn connect(username: String, password: String) -> Result<Session, String> {
|
||||
let tcp = TcpStream::connect("gitea.piwalker.net:22")
|
||||
.or(Err(format!("Unable to connect to host")))?;
|
||||
let mut sess = Session::new().or(Err(format!("Unable to creat stream")))?;
|
||||
sess.set_tcp_stream(tcp);
|
||||
sess.handshake().unwrap();
|
||||
sess.userauth_password(username.as_str(), password.as_str())
|
||||
.or(Err(format!("Invalid username or password")))?;
|
||||
Ok(sess)
|
||||
}
|
||||
|
||||
pub async fn uplaod(
|
||||
window: Option<tauri::AppHandle>,
|
||||
sess: Session,
|
||||
path: PathBuf,
|
||||
mut reader: impl Read,
|
||||
upload_name: String,
|
||||
total_size: usize,
|
||||
) -> Result<(), String> {
|
||||
let sftp = sess.sftp().or(Err("unable to open sftp session"))?;
|
||||
let mut file = sftp.create(path.as_path()).or(Err("Unable to open file"))?;
|
||||
let mut uploaded = 0;
|
||||
while true {
|
||||
let mut buf = vec![0u8; 1024 * 32];
|
||||
let res = reader.read(&mut buf).unwrap();
|
||||
if res <= 0 {
|
||||
if let Some(window) = window.clone() {
|
||||
window
|
||||
.emit("download_finished", true)
|
||||
.or(Err(format!("Unable to signal window!")))?;
|
||||
}
|
||||
break;
|
||||
}
|
||||
file.write_all(buf.split_at(res).0).unwrap();
|
||||
uploaded += res;
|
||||
println!(
|
||||
"Uploading {} {}MB / {}MB",
|
||||
upload_name,
|
||||
uploaded / (1024 * 1024),
|
||||
total_size / (1024 * 1024)
|
||||
);
|
||||
if let Some(window) = window.clone() {
|
||||
window
|
||||
.emit(
|
||||
"download_progress",
|
||||
https::DownloadStatus {
|
||||
downloaded: uploaded as usize,
|
||||
total: total_size as usize,
|
||||
time_elapsed: 0,
|
||||
download_name: upload_name.clone(),
|
||||
},
|
||||
)
|
||||
.or(Err(format!("Unable to signal window")))?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn mkdir(sess: Session, path: PathBuf) -> Result<(), String> {
|
||||
let sftp = sess.sftp().or(Err("Unable to open sftp session"))?;
|
||||
sftp.mkdir(path.as_path(), 0o775)
|
||||
.or(Err(format!("Unable to create directory")))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn rmdir(sess: Session, path: PathBuf) -> BoxFuture<'static, ()> {
|
||||
async move {
|
||||
let sftp = sess.sftp().or(Err("Unable to open sftp session")).unwrap();
|
||||
let dirs = sftp
|
||||
.readdir(path.as_path())
|
||||
.or(Err("unable to stat directory"))
|
||||
.unwrap();
|
||||
for dir in dirs {
|
||||
if dir.1.is_dir() {
|
||||
rmdir(sess.clone(), dir.0).await;
|
||||
} else {
|
||||
sftp.unlink(dir.0.as_path())
|
||||
.or(Err(format!("Unable to delete file")))
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
sftp.rmdir(path.as_path())
|
||||
.or(Err(format!("Unable to delete directory")))
|
||||
.unwrap();
|
||||
}
|
||||
.boxed()
|
||||
}
|
35
FCLauncher.old/src-tauri/src/system_dirs.rs
Normal file
@ -0,0 +1,35 @@
|
||||
use dirs::home_dir;
|
||||
use std::{
|
||||
env,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
pub fn get_local_data_directory() -> PathBuf {
|
||||
dirs::data_local_dir().unwrap().join("FCLauncher")
|
||||
}
|
||||
|
||||
pub fn get_data_directory() -> PathBuf {
|
||||
dirs::data_dir().unwrap().join("FCLauncher")
|
||||
}
|
||||
|
||||
pub fn get_java_executable() -> String {
|
||||
return format!(
|
||||
"java{}",
|
||||
if env::consts::OS == "windows" {
|
||||
".exe"
|
||||
} else {
|
||||
""
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
pub fn get_prism_executable() -> String {
|
||||
return format!(
|
||||
"{}",
|
||||
if env::consts::OS == "windows" {
|
||||
"prismlauncher.exe"
|
||||
} else {
|
||||
"PrismLauncher"
|
||||
}
|
||||
);
|
||||
}
|
46
FCLauncher.old/src-tauri/src/util.rs
Normal file
@ -0,0 +1,46 @@
|
||||
use std::clone;
|
||||
use tauri::Emitter;
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Clone, Serialize)]
|
||||
pub struct DownloadStatus {
|
||||
downloaded: usize,
|
||||
total: usize,
|
||||
time_elapsed: usize,
|
||||
download_name: String,
|
||||
}
|
||||
|
||||
pub fn download_callback(
|
||||
download_name: String,
|
||||
window: Option<tauri::AppHandle>,
|
||||
count: usize,
|
||||
size: usize,
|
||||
) {
|
||||
unsafe {
|
||||
static mut total: usize = 0;
|
||||
total += count;
|
||||
if let Some(window1) = window.clone() {
|
||||
window1.emit(
|
||||
"download_progress",
|
||||
DownloadStatus {
|
||||
downloaded: total,
|
||||
total: size,
|
||||
time_elapsed: 0,
|
||||
download_name: download_name,
|
||||
},
|
||||
);
|
||||
}
|
||||
println!(
|
||||
"Downloading {}MB / {}MB",
|
||||
total / (1024 * 1024),
|
||||
size / (1024 * 1024)
|
||||
);
|
||||
if count == 0 {
|
||||
if let Some(window2) = window {
|
||||
window2.emit("download_finished", true);
|
||||
}
|
||||
total = 0;
|
||||
}
|
||||
}
|
||||
}
|
43
FCLauncher.old/src-tauri/tauri.conf.json
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"build": {
|
||||
"frontendDist": "../src"
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"createUpdaterArtifacts": "v1Compatible"
|
||||
},
|
||||
"productName": "FCLauncher",
|
||||
"mainBinaryName": "FCLauncher",
|
||||
"version": "1.0.5",
|
||||
"identifier": "net.piwalker",
|
||||
"plugins": {
|
||||
"updater": {
|
||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDNDOEUwMjYxRUU2NEI5RgpSV1NmUytZZUp1RElBN3dEaGhpWG9JZVNQcFlnNFFzaXN0UnBsVmxNeVdWWnJoQmh4cGJRbjN3Ygo=",
|
||||
"endpoints": [
|
||||
"https://gitea.piwalker.net/fclauncher/app.json"
|
||||
]
|
||||
}
|
||||
},
|
||||
"app": {
|
||||
"security": {
|
||||
"csp": null
|
||||
},
|
||||
"withGlobalTauri": true,
|
||||
"windows": [
|
||||
{
|
||||
"title": "FCLauncher",
|
||||
"width": 800,
|
||||
"height": 600,
|
||||
"resizable": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
46
FCLauncher.old/src/Admin.html
Normal file
@ -0,0 +1,46 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="stylesheet" href="styles.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-width=cover" />
|
||||
<title>Tauri App</title>
|
||||
<script type="module" src="/admin.js" defer></script>
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<body>
|
||||
|
||||
<div class="Logo">
|
||||
<button id="back"></button>
|
||||
<img src="assets/Title.png" alt="Title" id="Title">
|
||||
</div>
|
||||
<div class="progress">
|
||||
<div class="progressFinished"></div>
|
||||
</div>
|
||||
|
||||
<div class="container-horizontal" data-bs-theme="dark">
|
||||
<div id="modpacks" >
|
||||
</div>
|
||||
<div class="vertical-buttons" >
|
||||
<button id="up" class="square-button"></button>
|
||||
<button id="down" class="square-button"></button>
|
||||
<button id="remove" class="square-button"></button>
|
||||
</div>
|
||||
<div class="vertical" id="update">
|
||||
<input placeholder="Version" id="pack_version" />
|
||||
<input placeholder="File" id="file_path" />
|
||||
<button id="browse">Browse</button>
|
||||
<button id="update_pack">Update Pack</button>
|
||||
</div>
|
||||
<div class="vertical" id="create">
|
||||
<input placeholder="Name" id="pack_name" />
|
||||
<input placeholder="ID" id="pack_id" />
|
||||
<button id="add">Create Pack</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
33
FCLauncher.old/src/Login.html
Normal file
@ -0,0 +1,33 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="stylesheet" href="styles.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-width=cover" />
|
||||
<title>Tauri App</title>
|
||||
<script type="module" src="/login.js" defer></script>
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<body>
|
||||
|
||||
<div class="Logo">
|
||||
<button id="back"></button>
|
||||
<img src="assets/Title.png" alt="Title" id="Title">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="container" data-bs-theme="dark">
|
||||
<p class="Error" id="Incorrect">Username or Password is incorrect!</p>
|
||||
<input id="Username" placeholder="Username" />
|
||||
<input id="Password" placeholder="Password" type="password" />
|
||||
<div class="loginButtons">
|
||||
<button id="Cancel">Cancel</button>
|
||||
<button id="Login">Login</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
141
FCLauncher.old/src/admin.js
Normal file
@ -0,0 +1,141 @@
|
||||
const { invoke } = window.__TAURI__.tauri;
|
||||
const { listen } = window.__TAURI__.event;
|
||||
const { ask, open, message } = window.__TAURI__.dialog;
|
||||
const downBar = document.querySelector(".progressFinished");
|
||||
//import { listen } from '@tauri-apps/api';
|
||||
|
||||
const error = listen("Error", (error) => {
|
||||
message(error.payload, {title: "Error", type: "error"});
|
||||
});
|
||||
|
||||
var selected_pack = "";
|
||||
var update_menu = document.getElementById("update");
|
||||
var create_menu = document.getElementById("create");
|
||||
|
||||
const download_progress = listen("download_progress", (progress) => {
|
||||
console.log("Downloading");
|
||||
//console.log("Downloaded "+progress.payload.downloaded/(1024*1024) +"MB / " + progress.payload.total/(1024*1024) + "MB");
|
||||
let downProgress = (progress.payload.downloaded/(1024*1024)).toFixed(2);
|
||||
let downTotal = (progress.payload.total/(1024*1024)).toFixed(2);
|
||||
downBar.style.width = `${(progress.payload.downloaded / progress.payload.total) * 100}%`;
|
||||
document.querySelector(".progress").style.visibility = "visible";
|
||||
});
|
||||
|
||||
const download_finished = listen("download_finished", (event) => {
|
||||
downBar.style.width = 0;
|
||||
document.querySelector(".progress").style.visibility = "hidden";
|
||||
});
|
||||
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
document.getElementById("browse").addEventListener("click", browse);
|
||||
document.getElementById("update_pack").addEventListener("click", update_pack);
|
||||
document.getElementById("up").addEventListener("click", up);
|
||||
document.getElementById("down").addEventListener("click", down);
|
||||
document.getElementById("add").addEventListener("click", add);
|
||||
document.getElementById("remove").addEventListener("click", remove);
|
||||
document.getElementById("back").addEventListener("click", back);
|
||||
|
||||
});
|
||||
|
||||
window.onload = async function() {
|
||||
refresh();
|
||||
}
|
||||
|
||||
function up(){
|
||||
invoke("shift_up", { id: selected_pack }).then(refresh);
|
||||
}
|
||||
|
||||
function down(){
|
||||
invoke("shift_down", { id: selected_pack }).then(refresh);
|
||||
}
|
||||
|
||||
function back(){
|
||||
invoke("drop_session");
|
||||
window.location.href = "index.html";
|
||||
}
|
||||
|
||||
function refresh(){
|
||||
update_menu.style.display = "none";
|
||||
create_menu.style.display = "none";
|
||||
invoke("get_modpacks").then(addModpacks);
|
||||
}
|
||||
|
||||
function addModpacks(modpacks) {
|
||||
var modpacks_list = document.getElementById("modpacks");
|
||||
while (modpacks_list.firstChild) {
|
||||
modpacks_list.removeChild(modpacks_list.lastChild);
|
||||
}
|
||||
for (let i = 0; i < modpacks.length; i++){
|
||||
var div = document.createElement("div");
|
||||
div.textContent = modpacks[i].name;
|
||||
div.className = "modpack";
|
||||
div.id = modpacks[i].id;
|
||||
if(modpacks[i].id == selected_pack){
|
||||
div.classList.add("modpack-selected");
|
||||
update_menu.style.display = "flex";
|
||||
invoke("get_latest_version", {id: selected_pack}).then(update_version);
|
||||
}
|
||||
div.addEventListener("click", function() { modpackClick(modpacks[i].id) });
|
||||
modpacks_list.appendChild(div);
|
||||
}
|
||||
|
||||
var div = document.createElement("div");
|
||||
div.textContent = "<Create New Pack>";
|
||||
div.className = "modpack";
|
||||
div.id = "*new*";
|
||||
div.addEventListener("click", function() { modpackClick("*new*") });
|
||||
modpacks_list.appendChild(div);
|
||||
}
|
||||
|
||||
function modpackClick(id){
|
||||
var old = selected_pack;
|
||||
document.getElementById(id).classList.add("modpack-selected");
|
||||
selected_pack = id;
|
||||
if (old == id){
|
||||
selected_pack = "";
|
||||
update_menu.style.display = "none";
|
||||
create_menu.style.display = "none";
|
||||
}else if (id == "*new*"){
|
||||
update_menu.style.display = "none";
|
||||
create_menu.style.display = "flex";
|
||||
}else{
|
||||
update_menu.style.display = "flex";
|
||||
create_menu.style.display = "none";
|
||||
invoke("get_latest_version", {id: selected_pack}).then(update_version);
|
||||
}
|
||||
document.getElementById(old).classList.remove("modpack-selected");
|
||||
}
|
||||
|
||||
function add(){
|
||||
var id = document.getElementById("pack_id").value;
|
||||
var name = document.getElementById("pack_name").value;
|
||||
selected_pack = id;
|
||||
invoke("add_pack", {id: id, name: name}).then(refresh);
|
||||
}
|
||||
|
||||
function remove(){
|
||||
ask("Are you sure you want to remove " + document.getElementById(selected_pack).textContent + "?", {title: "Are you sure?", type: "Message"}).then((value) => { if (value) { invoke("remove_pack", {id: selected_pack}).then(refresh); } });
|
||||
}
|
||||
|
||||
async function browse(){
|
||||
const selected = await open ({
|
||||
multiple: false,
|
||||
filters: [{
|
||||
name: 'Modrinth Modpack',
|
||||
extensions: ['mrpack']
|
||||
}]
|
||||
});
|
||||
if (selected != null){
|
||||
document.getElementById("file_path").value = selected;
|
||||
}
|
||||
}
|
||||
|
||||
function update_version(version){
|
||||
document.getElementById("pack_version").value = version;
|
||||
}
|
||||
|
||||
function update_pack(){
|
||||
var version = document.getElementById("pack_version").value;
|
||||
var path = document.getElementById("file_path").value;
|
||||
invoke("update_pack", {id: selected_pack, path: path, version: version}).then(refresh);
|
||||
}
|
BIN
FCLauncher.old/src/assets/CityBase.png
Normal file
After Width: | Height: | Size: 367 KiB |
BIN
FCLauncher.old/src/assets/Title.png
Normal file
After Width: | Height: | Size: 109 KiB |
BIN
FCLauncher.old/src/assets/add.png
Normal file
After Width: | Height: | Size: 9.5 KiB |
11
FCLauncher.old/src/assets/add.svg
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
|
||||
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg fill="#000000" height="800px" width="800px" version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" xmlns:xlink="http://www.w3.org/1999/xlink" enable-background="new 0 0 512 512">
|
||||
<g>
|
||||
<g>
|
||||
<path d="M256,11C120.9,11,11,120.9,11,256s109.9,245,245,245s245-109.9,245-245S391.1,11,256,11z M256,460.2 c-112.6,0-204.2-91.6-204.2-204.2S143.4,51.8,256,51.8S460.2,143.4,460.2,256S368.6,460.2,256,460.2z"/>
|
||||
<path d="m357.6,235.6h-81.2v-81.2c0-11.3-9.1-20.4-20.4-20.4-11.3,0-20.4,9.1-20.4,20.4v81.2h-81.2c-11.3,0-20.4,9.1-20.4,20.4s9.1,20.4 20.4,20.4h81.2v81.2c0,11.3 9.1,20.4 20.4,20.4 11.3,0 20.4-9.1 20.4-20.4v-81.2h81.2c11.3,0 20.4-9.1 20.4-20.4s-9.1-20.4-20.4-20.4z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 943 B |
BIN
FCLauncher.old/src/assets/back.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
FCLauncher.old/src/assets/down.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
1
FCLauncher.old/src/assets/javascript.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="32" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path fill="#F7DF1E" d="M0 0h256v256H0V0Z"></path><path d="m67.312 213.932l19.59-11.856c3.78 6.701 7.218 12.371 15.465 12.371c7.905 0 12.89-3.092 12.89-15.12v-81.798h24.057v82.138c0 24.917-14.606 36.259-35.916 36.259c-19.245 0-30.416-9.967-36.087-21.996m85.07-2.576l19.588-11.341c5.157 8.421 11.859 14.607 23.715 14.607c9.969 0 16.325-4.984 16.325-11.858c0-8.248-6.53-11.17-17.528-15.98l-6.013-2.58c-17.357-7.387-28.87-16.667-28.87-36.257c0-18.044 13.747-31.792 35.228-31.792c15.294 0 26.292 5.328 34.196 19.247l-18.732 12.03c-4.125-7.389-8.591-10.31-15.465-10.31c-7.046 0-11.514 4.468-11.514 10.31c0 7.217 4.468 10.14 14.778 14.608l6.014 2.577c20.45 8.765 31.963 17.7 31.963 37.804c0 21.654-17.012 33.51-39.867 33.51c-22.339 0-36.774-10.654-43.819-24.574"></path></svg>
|
After Width: | Height: | Size: 995 B |
BIN
FCLauncher.old/src/assets/remove.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
FCLauncher.old/src/assets/settings.jpg
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
FCLauncher.old/src/assets/settings.png
Normal file
After Width: | Height: | Size: 8.5 KiB |
6
FCLauncher.old/src/assets/tauri.svg
Normal file
@ -0,0 +1,6 @@
|
||||
<svg width="206" height="231" viewBox="0 0 206 231" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M143.143 84C143.143 96.1503 133.293 106 121.143 106C108.992 106 99.1426 96.1503 99.1426 84C99.1426 71.8497 108.992 62 121.143 62C133.293 62 143.143 71.8497 143.143 84Z" fill="#FFC131"/>
|
||||
<ellipse cx="84.1426" cy="147" rx="22" ry="22" transform="rotate(180 84.1426 147)" fill="#24C8DB"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M166.738 154.548C157.86 160.286 148.023 164.269 137.757 166.341C139.858 160.282 141 153.774 141 147C141 144.543 140.85 142.121 140.558 139.743C144.975 138.204 149.215 136.139 153.183 133.575C162.73 127.404 170.292 118.608 174.961 108.244C179.63 97.8797 181.207 86.3876 179.502 75.1487C177.798 63.9098 172.884 53.4021 165.352 44.8883C157.82 36.3744 147.99 30.2165 137.042 27.1546C126.095 24.0926 114.496 24.2568 103.64 27.6274C92.7839 30.998 83.1319 37.4317 75.8437 46.1553C74.9102 47.2727 74.0206 48.4216 73.176 49.5993C61.9292 50.8488 51.0363 54.0318 40.9629 58.9556C44.2417 48.4586 49.5653 38.6591 56.679 30.1442C67.0505 17.7298 80.7861 8.57426 96.2354 3.77762C111.685 -1.01901 128.19 -1.25267 143.769 3.10474C159.348 7.46215 173.337 16.2252 184.056 28.3411C194.775 40.457 201.767 55.4101 204.193 71.404C206.619 87.3978 204.374 103.752 197.73 118.501C191.086 133.25 180.324 145.767 166.738 154.548ZM41.9631 74.275L62.5557 76.8042C63.0459 72.813 63.9401 68.9018 65.2138 65.1274C57.0465 67.0016 49.2088 70.087 41.9631 74.275Z" fill="#FFC131"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M38.4045 76.4519C47.3493 70.6709 57.2677 66.6712 67.6171 64.6132C65.2774 70.9669 64 77.8343 64 85.0001C64 87.1434 64.1143 89.26 64.3371 91.3442C60.0093 92.8732 55.8533 94.9092 51.9599 97.4256C42.4128 103.596 34.8505 112.392 30.1816 122.756C25.5126 133.12 23.9357 144.612 25.6403 155.851C27.3449 167.09 32.2584 177.598 39.7906 186.112C47.3227 194.626 57.153 200.784 68.1003 203.846C79.0476 206.907 90.6462 206.743 101.502 203.373C112.359 200.002 122.011 193.568 129.299 184.845C130.237 183.722 131.131 182.567 131.979 181.383C143.235 180.114 154.132 176.91 164.205 171.962C160.929 182.49 155.596 192.319 148.464 200.856C138.092 213.27 124.357 222.426 108.907 227.222C93.458 232.019 76.9524 232.253 61.3736 227.895C45.7948 223.538 31.8055 214.775 21.0867 202.659C10.3679 190.543 3.37557 175.59 0.949823 159.596C-1.47592 143.602 0.768139 127.248 7.41237 112.499C14.0566 97.7497 24.8183 85.2327 38.4045 76.4519ZM163.062 156.711L163.062 156.711C162.954 156.773 162.846 156.835 162.738 156.897C162.846 156.835 162.954 156.773 163.062 156.711Z" fill="#24C8DB"/>
|
||||
</svg>
|
After Width: | Height: | Size: 2.5 KiB |
BIN
FCLauncher.old/src/assets/up.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
50
FCLauncher.old/src/index.html
Normal file
@ -0,0 +1,50 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="stylesheet" href="styles.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-width=cover" />
|
||||
<title>Tauri App</title>
|
||||
<script type="module" src="/main.js" defer></script>
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<body>
|
||||
|
||||
<div class="Logo">
|
||||
<button id="settings"></button>
|
||||
<img src="assets/Title.png" alt="Title" id="Title">
|
||||
</div>
|
||||
<div class="progress">
|
||||
<div class="progressFinished"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="container" data-bs-theme="dark">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<select name="modSelect" id="Modpacks" class="bg-dark text-white">
|
||||
</select>
|
||||
|
||||
<p id="download_name"></p>
|
||||
<p id="download_progress"></p>
|
||||
|
||||
<button id="launchGame" type="button">Launch Minecraft</button>
|
||||
|
||||
<div class="horizontal">
|
||||
<a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ?autoplay=1"
|
||||
target="_blank" class="buttonlink left">
|
||||
<button>Buy Me A Coffee!</button>
|
||||
</a>
|
||||
<button id="prism" class="right">Open Prism launcher</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
42
FCLauncher.old/src/login.js
Normal file
@ -0,0 +1,42 @@
|
||||
const { invoke } = window.__TAURI__.tauri;
|
||||
const { listen } = window.__TAURI__.event;
|
||||
const { ask, message } = window.__TAURI__.dialog;
|
||||
const downBar = document.querySelector(".progressFinished");
|
||||
//import { listen } from '@tauri-apps/api';
|
||||
|
||||
const error = listen("Error", (error) => {
|
||||
message(error.payload, {title: "Error", type: "error"});
|
||||
});
|
||||
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
document.getElementById("back").addEventListener("click", back);
|
||||
document.getElementById("Cancel").addEventListener("click", back);
|
||||
document.getElementById("Login").addEventListener("click", login);
|
||||
document.getElementById("Password").addEventListener("keypress", keypress);
|
||||
|
||||
});
|
||||
|
||||
function back(){
|
||||
invoke("drop_session");
|
||||
window.location.href = "index.html";
|
||||
}
|
||||
|
||||
function login(){
|
||||
invoke("login", { username: document.getElementById("Username").value, password: document.getElementById("Password").value});
|
||||
}
|
||||
|
||||
function keypress(e){
|
||||
if(e.keyCode === 13){
|
||||
e.preventDefault();
|
||||
login();
|
||||
}
|
||||
}
|
||||
|
||||
const failed = listen("Login_Failed", (event) => {
|
||||
document.getElementById("Incorrect").style.visibility = "visible";
|
||||
})
|
||||
|
||||
const success = listen("Login_Success", (event) => {
|
||||
window.location.href = "Admin.html";
|
||||
})
|
114
FCLauncher.old/src/main.js
Normal file
@ -0,0 +1,114 @@
|
||||
const { invoke } = window.__TAURI__.tauri;
|
||||
const { listen } = window.__TAURI__.event;
|
||||
const { ask, message } = window.__TAURI__.dialog;
|
||||
const { exit } = window.__TAURI__.process;
|
||||
const downBar = document.querySelector(".progressFinished");
|
||||
//import { listen } from '@tauri-apps/api';
|
||||
|
||||
const error = listen("Error", (error) => {
|
||||
message(error.payload, {title: "Error", type: "error"});
|
||||
});
|
||||
|
||||
const download_progress = listen("download_progress", (progress) => {
|
||||
console.log("Downloading");
|
||||
//console.log("Downloaded "+progress.payload.downloaded/(1024*1024) +"MB / " + progress.payload.total/(1024*1024) + "MB");
|
||||
let downProgress = (progress.payload.downloaded/(1024*1024)).toFixed(2);
|
||||
let downTotal = (progress.payload.total/(1024*1024)).toFixed(2);
|
||||
document.getElementById("download_name").textContent = "Downloading "+progress.payload.download_name;
|
||||
document.getElementById("download_progress").textContent = downProgress + "MB / "+downTotal+"MB";
|
||||
document.getElementById("launchGame").disabled = true;
|
||||
downBar.style.width = `${(progress.payload.downloaded / progress.payload.total) * 100}%`;
|
||||
document.querySelector(".progress").style.visibility = "visible";
|
||||
});
|
||||
|
||||
const download_finished = listen("download_finished", (event) => {
|
||||
document.getElementById("download_name").textContent = "";
|
||||
document.getElementById("download_progress").textContent = "";
|
||||
document.getElementById("launchGame").disabled = false;
|
||||
document.getElementById("launchGame").textContent ="Launch Minecraft";
|
||||
downBar.style.width = 0;
|
||||
document.querySelector(".progress").style.visibility = "hidden";
|
||||
});
|
||||
|
||||
const update_dialog = listen("update_dialog", (event) => {
|
||||
ask("Do you want to update?", {title: "Update Available", type: "Message"}).then((value) => { if (value) { invoke("update").then(window.close()); } });
|
||||
});
|
||||
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
document.getElementById("launchGame").addEventListener("click", gameLaunch);
|
||||
document.getElementById("prism").addEventListener("click", prism);
|
||||
document.getElementById("settings").addEventListener("click", login);
|
||||
document.getElementById("back").addEventListener("click", back);
|
||||
|
||||
});
|
||||
function packSelect() {
|
||||
document.getElementById("myDropdown").classList.toggle("show");
|
||||
|
||||
}
|
||||
|
||||
function login(){
|
||||
window.location.href = "Login.html";
|
||||
}
|
||||
|
||||
function back(){
|
||||
console.log("test");
|
||||
window.location.href = "index.html";
|
||||
}
|
||||
|
||||
function load() {
|
||||
console.log("loading");
|
||||
var dropdown = document.getElementById("Modpacks");
|
||||
var opt = document.createElement("option");
|
||||
opt.text = 'something';
|
||||
opt.value = 'somethings value';
|
||||
dropdown.options.add(opt);
|
||||
}
|
||||
|
||||
window.onload = async function() {
|
||||
invoke("install_prism");
|
||||
invoke("get_modpacks").then(addModpacks);
|
||||
console.log(downBar.style.width)
|
||||
}
|
||||
|
||||
function addModpacks(modpacks) {
|
||||
|
||||
var dropdown = document.getElementById("Modpacks");
|
||||
//modpacks.sort((a, b) => a.name.localeCompare(b.name));
|
||||
//modpacks.reverse();
|
||||
for (let i = 0; i < modpacks.length; i++){
|
||||
var opt = document.createElement("option");
|
||||
opt.text = modpacks[i].name;
|
||||
opt.value = modpacks[i].id;
|
||||
dropdown.options.add(opt);
|
||||
}
|
||||
}
|
||||
|
||||
function gameLaunch() {
|
||||
var packId = document.getElementById("Modpacks");
|
||||
var selectedId = packId.value;
|
||||
document.getElementById("launchGame").disabled = true;
|
||||
document.getElementById("launchGame").textContent ="Launching...";
|
||||
//TODO Launch Game
|
||||
invoke("launch_modpack", { id: selectedId}).then(() => { exit(1); });
|
||||
|
||||
|
||||
}
|
||||
|
||||
function prism(){
|
||||
invoke("launch_prism");
|
||||
}
|
||||
|
||||
|
||||
//window.onclick = function(event) {
|
||||
//if (!event.target.matches('.dropbtn')) {
|
||||
//var dropdowns = document.getElementsByClassName("dropdown-content");
|
||||
//var i;
|
||||
//for (i = 0; i < dropdowns.length; i++) {
|
||||
//var openDropdown = dropdowns[i];
|
||||
//if (openDropdown.classList.contains('show')) {
|
||||
//openDropdown.classList.remove('show');
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
//}
|
374
FCLauncher.old/src/styles.css
Normal file
@ -0,0 +1,374 @@
|
||||
.logo.vanilla:hover {
|
||||
filter: drop-shadow(0 0 2em #ffe21c);
|
||||
}
|
||||
:root {
|
||||
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
font-weight: 400;
|
||||
color-scheme: dark;
|
||||
|
||||
background-color: Canvas;
|
||||
color: CanvasText;
|
||||
|
||||
font-synthesis: none;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
.container {
|
||||
margin: 0;
|
||||
padding-top: 30px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.vertical {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
gap: 1em;
|
||||
}
|
||||
|
||||
.container-horizontal {
|
||||
margin: 0;
|
||||
padding-top: 30px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
align-items: left;
|
||||
justify-content: left;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.horizontal-input {
|
||||
margin: 0;
|
||||
margin-left: 5px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
align-items: left;
|
||||
justify-content: left;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
background-color: Canvas;
|
||||
color: CanvasText;
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 6em;
|
||||
padding: 0em;
|
||||
will-change: filter;
|
||||
transition: 0.75s;
|
||||
}
|
||||
|
||||
.logo.tauri:hover {
|
||||
filter: drop-shadow(0 0 2em #24c8db);
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: 500;
|
||||
color: #646cff;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #535bf2;
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
input,
|
||||
button {
|
||||
border-radius: 8px;
|
||||
border: 1px solid transparent;
|
||||
padding: 0.6em 1.2em;
|
||||
font-size: 1em;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
color: #4df3ff;
|
||||
background-color: #474747;
|
||||
transition: border-color 0.25s;
|
||||
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
|
||||
width: 300px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
border-color: #396cd8;
|
||||
}
|
||||
button:active {
|
||||
border-color: #396cd8;
|
||||
background-color: #e8e8e8;
|
||||
}
|
||||
|
||||
input,
|
||||
button {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#greet-input {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
background-color: Canvas;
|
||||
color: CanvasText;
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #24c8db;
|
||||
}
|
||||
|
||||
input,
|
||||
button {
|
||||
color: #ffffff;
|
||||
background-color: #0f0f0f98;
|
||||
}
|
||||
button:active {
|
||||
background-color: #0f0f0f69;
|
||||
}
|
||||
|
||||
.dropbtn {
|
||||
background-color: #3498DB;
|
||||
color: white;
|
||||
padding: 16px;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dropbtn:hover, .dropbtn:focus {
|
||||
background-color: #2980B9;
|
||||
}
|
||||
|
||||
.dropdown {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.dropdown-content {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: #f1f1f1;
|
||||
min-width: 160px;
|
||||
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#text {
|
||||
color: black;
|
||||
padding: 12px 16px;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.dropdown-content a:hover {background-color: #DDD;}
|
||||
|
||||
.show {display:block;}
|
||||
|
||||
}
|
||||
|
||||
.progress {
|
||||
background-color: grey;
|
||||
border-radius: 20px;
|
||||
height: 15px;
|
||||
width: 100%;
|
||||
visibility: hidden;
|
||||
}
|
||||
.progressFinished{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #3498DB;
|
||||
border-radius: 20px;
|
||||
height: 100%;
|
||||
width: 0;
|
||||
/*transition: 1s ease 0.3s;*/
|
||||
}
|
||||
#Modpacks{
|
||||
width:300px ;
|
||||
align-content: center;
|
||||
align-self: center;
|
||||
align-items: center;
|
||||
background-color: #2f2f2f;
|
||||
border: 2px solid rgb(26, 26, 26);
|
||||
|
||||
}
|
||||
.Logo{
|
||||
background-image: url('assets/CityBase.png');
|
||||
box-shadow: 0px 20px 10px #121313;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
height: auto;
|
||||
background-repeat: no-repeat;
|
||||
flex-direction: column;
|
||||
background-size: contain;
|
||||
}
|
||||
#launchGame {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
|
||||
.modSelect.select{
|
||||
background: #272727;
|
||||
flood-color: #0f0f0f;
|
||||
}
|
||||
|
||||
.buttonlink{
|
||||
width: fit-content;
|
||||
block-size: fit-content;
|
||||
}
|
||||
|
||||
.right{
|
||||
float: right;
|
||||
}
|
||||
|
||||
.left{
|
||||
float: left;
|
||||
}
|
||||
|
||||
.horizontal{
|
||||
overflow: auto;
|
||||
display: block;
|
||||
margin: 0.5em;
|
||||
}
|
||||
|
||||
#settings{
|
||||
width: 2em;
|
||||
height: 2.5em;
|
||||
top: 5px;
|
||||
left: 5px;
|
||||
float: right;
|
||||
position: absolute;
|
||||
background-image: url('assets/settings.png');
|
||||
background-size:cover;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
#back{
|
||||
width: 2em;
|
||||
height: 2.5em;
|
||||
top: 5px;
|
||||
left: 5px;
|
||||
float: right;
|
||||
position: absolute;
|
||||
background-image: url('assets/back.png');
|
||||
background-size:cover;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.container input{
|
||||
margin: 0.5em;
|
||||
width: 45%
|
||||
}
|
||||
|
||||
.loginButtons{
|
||||
display: flex;
|
||||
margin: 0.5em;
|
||||
flex-direction: row;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 50%;
|
||||
gap: .5em;
|
||||
}
|
||||
|
||||
.Error{
|
||||
color: black;
|
||||
background-color: red;
|
||||
margin: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#modpacks{
|
||||
width: 30%;
|
||||
height: 13em;
|
||||
background-color: #666565;
|
||||
overflow: auto;
|
||||
margin-left: 10px;
|
||||
border: 1px solid;
|
||||
}
|
||||
|
||||
.modpack {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.modpack:hover {
|
||||
background-color: lightgray;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.modpack-selected {
|
||||
background-color: blue;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.vertical-buttons {
|
||||
display: flex;
|
||||
margin-left: 0.5em;
|
||||
margin-top: 0;
|
||||
flex-direction: column;
|
||||
height: 15em;
|
||||
gap: 1.5em;
|
||||
}
|
||||
|
||||
.square-button {
|
||||
width: 2em;
|
||||
height: 2.5em;
|
||||
top: 5px;
|
||||
left: 5px;
|
||||
}
|
||||
|
||||
#up{
|
||||
background-image: url('assets/up.png');
|
||||
background-size:cover;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
#down{
|
||||
background-image: url('assets/down.png');
|
||||
background-size:cover;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
#create{
|
||||
display: none;
|
||||
}
|
||||
|
||||
#update{
|
||||
display: none;
|
||||
}
|
||||
|
||||
#remove{
|
||||
background-image: url('assets/remove.png');
|
||||
background-size:cover;
|
||||
background-repeat: no-repeat;
|
||||
}
|
34
FCLauncher.old/yarn.lock
Normal file
@ -0,0 +1,34 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@tauri-apps/api@^1.5.6":
|
||||
version "1.5.6"
|
||||
resolved "https://registry.npmjs.org/@tauri-apps/api/-/api-1.5.6.tgz"
|
||||
integrity sha512-LH5ToovAHnDVe5Qa9f/+jW28I6DeMhos8bNDtBOmmnaDpPmJmYLyHdeDblAWWWYc7KKRDg9/66vMuKyq0WIeFA==
|
||||
|
||||
"@tauri-apps/cli-linux-x64-gnu@1.5.14":
|
||||
version "1.5.14"
|
||||
resolved "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-1.5.14.tgz"
|
||||
integrity sha512-kD9v/UwPDuhIgq2TJj/s2/7rqk+vmExVV6xHPKI8vVbIvlNAOZqmx3fpxjej1241vhJ/piGd/m6q6YMWGsL0oQ==
|
||||
|
||||
"@tauri-apps/cli-linux-x64-musl@1.5.14":
|
||||
version "1.5.14"
|
||||
resolved "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-1.5.14.tgz"
|
||||
integrity sha512-204Drgg9Zx0+THKndqASz4+iPCwqA3gQVF9C0CDIArNXrjPyJjVvW8VP5CHiZYaTNWxlz/ltyxluM6UFWbXNFw==
|
||||
|
||||
"@tauri-apps/cli@^1":
|
||||
version "1.5.14"
|
||||
resolved "https://registry.npmjs.org/@tauri-apps/cli/-/cli-1.5.14.tgz"
|
||||
integrity sha512-JOSMKymlg116UdEXSj69eg5p1OtZnQkUE0qIGbtNDO1sk3X/KgBN6+oHBW0BzPStp/W0AjBgrMWCqjHPwEpOug==
|
||||
optionalDependencies:
|
||||
"@tauri-apps/cli-darwin-arm64" "1.5.14"
|
||||
"@tauri-apps/cli-darwin-x64" "1.5.14"
|
||||
"@tauri-apps/cli-linux-arm-gnueabihf" "1.5.14"
|
||||
"@tauri-apps/cli-linux-arm64-gnu" "1.5.14"
|
||||
"@tauri-apps/cli-linux-arm64-musl" "1.5.14"
|
||||
"@tauri-apps/cli-linux-x64-gnu" "1.5.14"
|
||||
"@tauri-apps/cli-linux-x64-musl" "1.5.14"
|
||||
"@tauri-apps/cli-win32-arm64-msvc" "1.5.14"
|
||||
"@tauri-apps/cli-win32-ia32-msvc" "1.5.14"
|
||||
"@tauri-apps/cli-win32-x64-msvc" "1.5.14"
|