mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew.git
synced 2025-12-14 00:57:34 -06:00
Compare commits
13 commits
d1ee220edb
...
6d541a81ef
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d541a81ef | |||
| b9f9929ea9 | |||
| 2cc2138eda | |||
| bab9868355 | |||
| ad0d222c96 | |||
| 60eb7d469b | |||
| 66f97c48ee | |||
| d4a5f0dd11 | |||
| 9a072823a0 | |||
| 74a00769aa | |||
| fd47262f52 | |||
| b9b344b50c | |||
| 99da87095b |
25 changed files with 881 additions and 1180 deletions
|
|
@ -8,6 +8,9 @@ jobs:
|
|||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checking out branch
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
|
|
@ -26,7 +29,7 @@ jobs:
|
|||
- name: Extract version from Cargo.toml
|
||||
shell: bash
|
||||
run: |
|
||||
echo "EW_VERSION=$(grep "^version" Cargo.toml | sed -E 's/version\s*=\s*["]([^"]*)["]/\1/')" >> $GITHUB_ENV
|
||||
echo "APP_VERSION=$(grep "^version" Cargo.toml | sed -E 's/version\s*=\s*["]([^"]*)["]/\1/')" >> $GITHUB_ENV
|
||||
|
||||
- name: Log in to DockerHub
|
||||
uses: docker/login-action@v3
|
||||
|
|
@ -39,9 +42,9 @@ jobs:
|
|||
uses: docker/metadata-action@master
|
||||
with:
|
||||
images: |
|
||||
docker.io/ethanaobrien/ew
|
||||
docker.io/ethanaobrien/ew
|
||||
flavor: |
|
||||
latest=false
|
||||
latest=false
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
|
||||
|
|
@ -52,10 +55,12 @@ jobs:
|
|||
push: true
|
||||
labels: |
|
||||
gitsha1=${{ github.sha }}
|
||||
org.opencontainers.image.version=${{ env.EW_VERSION }}
|
||||
tags: "${{ steps.set-tag.outputs.tags }}"
|
||||
org.opencontainers.image.version=${{ env.APP_VERSION }}
|
||||
tags: |
|
||||
${{ steps.set-tag.outputs.tags }}
|
||||
docker.io/ethanaobrien/ew:${{ env.APP_VERSION }}
|
||||
file: "docker/Dockerfile"
|
||||
platforms: linux/amd64 #,linux/arm64
|
||||
platforms: linux/amd64, linux/arm64
|
||||
|
||||
# arm64 builds OOM without the git fetch setting. c.f.
|
||||
# https://github.com/rust-lang/cargo/issues/10583
|
||||
|
|
|
|||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -9,3 +9,4 @@ config.json
|
|||
docker/data/
|
||||
.idea/
|
||||
ndk/
|
||||
.DS_Store
|
||||
|
|
|
|||
362
Cargo.lock
generated
362
Cargo.lock
generated
|
|
@ -65,7 +65,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -132,9 +132,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "actix-web"
|
||||
version = "4.12.0"
|
||||
version = "4.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2233f53f6cb18ae038ce1f0713ca0c72ca0c4b71fe9aaeb59924ce2c89c6dd85"
|
||||
checksum = "1654a77ba142e37f049637a3e5685f864514af11fcbc51cb51eb6596afe5b8d6"
|
||||
dependencies = [
|
||||
"actix-codec",
|
||||
"actix-http",
|
||||
|
|
@ -182,7 +182,7 @@ dependencies = [
|
|||
"actix-router",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -330,6 +330,15 @@ dependencies = [
|
|||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block2"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5"
|
||||
dependencies = [
|
||||
"objc2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "brotli"
|
||||
version = "8.0.2"
|
||||
|
|
@ -383,9 +392,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.46"
|
||||
version = "1.2.48"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36"
|
||||
checksum = "c481bdbf0ed3b892f6f806287d72acd515b352a4ec27a208489b8c1bc839633a"
|
||||
dependencies = [
|
||||
"find-msvc-tools",
|
||||
"jobserver",
|
||||
|
|
@ -393,6 +402,12 @@ dependencies = [
|
|||
"shlex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cesu8"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.4"
|
||||
|
|
@ -440,7 +455,7 @@ dependencies = [
|
|||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -455,6 +470,16 @@ version = "1.0.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
||||
|
||||
[[package]]
|
||||
name = "combine"
|
||||
version = "4.6.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const-oid"
|
||||
version = "0.9.6"
|
||||
|
|
@ -552,7 +577,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
|
|
@ -568,6 +593,16 @@ dependencies = [
|
|||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dispatch2"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"objc2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "displaydoc"
|
||||
version = "0.2.5"
|
||||
|
|
@ -576,7 +611,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -602,15 +637,19 @@ dependencies = [
|
|||
"aes",
|
||||
"base64",
|
||||
"cbc",
|
||||
"cc",
|
||||
"clap",
|
||||
"hex",
|
||||
"hmac",
|
||||
"include-flate-codegen",
|
||||
"jni",
|
||||
"json",
|
||||
"lazy_static",
|
||||
"libflate",
|
||||
"md5",
|
||||
"mime",
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
"pem",
|
||||
"rand 0.9.2",
|
||||
"rsa",
|
||||
|
|
@ -741,6 +780,12 @@ dependencies = [
|
|||
"wasip2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glob"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
|
||||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.3.27"
|
||||
|
|
@ -823,12 +868,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "1.3.1"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565"
|
||||
checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
"itoa",
|
||||
]
|
||||
|
||||
|
|
@ -963,7 +1007,7 @@ dependencies = [
|
|||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
"zstd",
|
||||
]
|
||||
|
||||
|
|
@ -1009,6 +1053,39 @@ version = "1.0.15"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
||||
|
||||
[[package]]
|
||||
name = "java-locator"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09c46c1fe465c59b1474e665e85e1256c3893dd00927b8d55f63b09044c1e64f"
|
||||
dependencies = [
|
||||
"glob",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jni"
|
||||
version = "0.21.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97"
|
||||
dependencies = [
|
||||
"cesu8",
|
||||
"cfg-if",
|
||||
"combine",
|
||||
"java-locator",
|
||||
"jni-sys",
|
||||
"libloading",
|
||||
"log",
|
||||
"thiserror",
|
||||
"walkdir",
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jni-sys"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
|
||||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
version = "0.1.34"
|
||||
|
|
@ -1021,9 +1098,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.82"
|
||||
version = "0.3.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65"
|
||||
checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"wasm-bindgen",
|
||||
|
|
@ -1080,6 +1157,16 @@ dependencies = [
|
|||
"rle-decode-fast",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.15"
|
||||
|
|
@ -1227,6 +1314,45 @@ dependencies = [
|
|||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7c2599ce0ec54857b29ce62166b0ed9b4f6f1a70ccc9a71165b6154caca8c05"
|
||||
dependencies = [
|
||||
"objc2-encode",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-core-foundation"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"dispatch2",
|
||||
"objc2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-encode"
|
||||
version = "4.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
|
||||
|
||||
[[package]]
|
||||
name = "objc2-foundation"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"block2",
|
||||
"libc",
|
||||
"objc2",
|
||||
"objc2-core-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.21.3"
|
||||
|
|
@ -1572,9 +1698,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustls-pki-types"
|
||||
version = "1.13.0"
|
||||
version = "1.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94182ad936a0c91c324cd46c6511b9510ed16af436d7b5bab34beab0afd55f7a"
|
||||
checksum = "708c0f9d5f54ba0272468c1d306a52c495b31fa155e91bc25371e6df7996908c"
|
||||
dependencies = [
|
||||
"zeroize",
|
||||
]
|
||||
|
|
@ -1602,6 +1728,15 @@ version = "1.0.20"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.2.0"
|
||||
|
|
@ -1635,7 +1770,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1693,9 +1828,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
|||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.6"
|
||||
version = "1.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b"
|
||||
checksum = "7664a098b8e616bdfcc2dc0e9ac44eb231eedf41db4e9fe95d8d32ec728dedad"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
|
@ -1803,9 +1938,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.110"
|
||||
version = "2.0.111"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea"
|
||||
checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -1820,7 +1955,27 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1895,9 +2050,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.41"
|
||||
version = "0.1.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
|
||||
checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647"
|
||||
dependencies = [
|
||||
"log",
|
||||
"pin-project-lite",
|
||||
|
|
@ -1907,20 +2062,20 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tracing-attributes"
|
||||
version = "0.1.30"
|
||||
version = "0.1.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903"
|
||||
checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.34"
|
||||
version = "0.1.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678"
|
||||
checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
|
@ -1968,12 +2123,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ureq-proto"
|
||||
version = "0.5.2"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60b4531c118335662134346048ddb0e54cc86bd7e81866757873055f0e38f5d2"
|
||||
checksum = "d81f9efa9df032be5934a46a068815a10a042b494b6a58cb0a1a97bb5467ed6f"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"http 1.3.1",
|
||||
"http 1.4.0",
|
||||
"httparse",
|
||||
"log",
|
||||
]
|
||||
|
|
@ -2037,6 +2192,16 @@ version = "0.9.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.1+wasi-snapshot-preview1"
|
||||
|
|
@ -2054,9 +2219,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.105"
|
||||
version = "0.2.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60"
|
||||
checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
|
|
@ -2067,9 +2232,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.105"
|
||||
version = "0.2.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2"
|
||||
checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
|
|
@ -2077,22 +2242,22 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.105"
|
||||
version = "0.2.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc"
|
||||
checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.105"
|
||||
version = "0.2.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76"
|
||||
checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
|
@ -2106,12 +2271,52 @@ dependencies = [
|
|||
"rustls-pki-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.45.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
|
||||
dependencies = [
|
||||
"windows-targets 0.42.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
|
|
@ -2139,6 +2344,21 @@ dependencies = [
|
|||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.42.2",
|
||||
"windows_aarch64_msvc 0.42.2",
|
||||
"windows_i686_gnu 0.42.2",
|
||||
"windows_i686_msvc 0.42.2",
|
||||
"windows_x86_64_gnu 0.42.2",
|
||||
"windows_x86_64_gnullvm 0.42.2",
|
||||
"windows_x86_64_msvc 0.42.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.6"
|
||||
|
|
@ -2172,6 +2392,12 @@ dependencies = [
|
|||
"windows_x86_64_msvc 0.53.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.6"
|
||||
|
|
@ -2184,6 +2410,12 @@ version = "0.53.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.6"
|
||||
|
|
@ -2196,6 +2428,12 @@ version = "0.53.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.6"
|
||||
|
|
@ -2220,6 +2458,12 @@ version = "0.53.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.6"
|
||||
|
|
@ -2232,6 +2476,12 @@ version = "0.53.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.6"
|
||||
|
|
@ -2244,6 +2494,12 @@ version = "0.53.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.6"
|
||||
|
|
@ -2256,6 +2512,12 @@ version = "0.53.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.6"
|
||||
|
|
@ -2299,28 +2561,28 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.28"
|
||||
version = "0.8.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43fa6694ed34d6e57407afbccdeecfa268c470a7d2a5b0cf49ce9fcc345afb90"
|
||||
checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.28"
|
||||
version = "0.8.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c640b22cd9817fae95be82f0d2f90b11f7605f6c319d16705c459b27ac2cbc26"
|
||||
checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2340,7 +2602,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
|
|
@ -2380,7 +2642,7 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
|||
18
Cargo.toml
18
Cargo.toml
|
|
@ -27,3 +27,21 @@ cbc = { version = "0.1.2", features = ["alloc"] }
|
|||
aes = "0.8.4"
|
||||
pem = "3.0.6"
|
||||
ureq = "3.1.4"
|
||||
|
||||
[target.aarch64-linux-android.dependencies]
|
||||
jni = { version = "0.21.1", features = ["invocation", "default"] }
|
||||
|
||||
[target.aarch64-apple-ios.dependencies]
|
||||
objc2 = "0.6.3"
|
||||
objc2-foundation = { version = "0.3.2", features = ["NSFileManager"] }
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1.0"
|
||||
|
||||
# To enable this library you MUST comment out lib block below and add --features library
|
||||
[features]
|
||||
library = []
|
||||
|
||||
#[lib]
|
||||
#crate-type = ["cdylib"]
|
||||
#required-features = ["library"]
|
||||
|
|
|
|||
2
LICENSE
2
LICENSE
|
|
@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
|
|||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
ew Copyright (C) 2024-2025 Ethan O'Brien
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
|
|
|||
|
|
@ -1,56 +0,0 @@
|
|||
const express = require('express')
|
||||
const app = express()
|
||||
const fs = require('fs');
|
||||
var http = require('http');
|
||||
|
||||
const ip = '0.0.0.0';
|
||||
const port = 8887;
|
||||
//https://lovelive-schoolidolfestival2-album.akamaized.net
|
||||
app.use(function (req, res, next) {
|
||||
console.log(req.method, ":", req.url);
|
||||
next();
|
||||
})
|
||||
function createDirFromFile(path) {
|
||||
fs.mkdirSync(require('path').dirname(path), { recursive: true });
|
||||
}
|
||||
|
||||
app.get('/*', function (req, res) {
|
||||
const expectedPath = __dirname + "/resources"+req.url.split("?")[0];
|
||||
createDirFromFile(expectedPath);
|
||||
|
||||
let downloading = [];
|
||||
if (fs.existsSync(expectedPath)) {
|
||||
res.sendFile(expectedPath)
|
||||
} else {
|
||||
let url;
|
||||
if (req.url.split("/")[2].length !== 2) {
|
||||
url = (req.url.toLowerCase().startsWith("/android") || req.url.toLowerCase().startsWith("/ios") ? "https://lovelive-schoolidolfestival2-assets.akamaized.net" : "https://lovelive-schoolidolfestival2-album.akamaized.net") + req.url;
|
||||
} else {
|
||||
url = (req.url.toLowerCase().startsWith("/android") || req.url.toLowerCase().startsWith("/ios") ? "https://img-sif2.lovelive-sif2.com" : "https://album-sif2.lovelive-sif2.com") + req.url;
|
||||
}
|
||||
const request = require('https').get(url, function(response) {
|
||||
response.pipe(res);
|
||||
});
|
||||
if (downloading.includes(req.url)) return;
|
||||
require('https').get(url, function(response) {
|
||||
console.log("Downloading " + req.url);
|
||||
downloading.push(req.url);
|
||||
const file = fs.createWriteStream(expectedPath);
|
||||
response.pipe(file);
|
||||
|
||||
// after download completed close filestream
|
||||
file.on("finish", () => {
|
||||
file.close();
|
||||
console.log("Download Completed " + req.url);
|
||||
});
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
var httpsServer = http.createServer(app);
|
||||
|
||||
|
||||
httpsServer.listen(port, ip, () => {
|
||||
let url = 'http://' + ip + ':' + port
|
||||
console.log('Server is listening at', url)
|
||||
})
|
||||
690
asset_server/package-lock.json
generated
690
asset_server/package-lock.json
generated
|
|
@ -1,690 +0,0 @@
|
|||
{
|
||||
"name": "a",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"express": "^4.18.2"
|
||||
}
|
||||
},
|
||||
"node_modules/accepts": {
|
||||
"version": "1.3.8",
|
||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
||||
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
|
||||
"dependencies": {
|
||||
"mime-types": "~2.1.34",
|
||||
"negotiator": "0.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/array-flatten": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
|
||||
},
|
||||
"node_modules/body-parser": {
|
||||
"version": "1.20.1",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
|
||||
"integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
|
||||
"dependencies": {
|
||||
"bytes": "3.1.2",
|
||||
"content-type": "~1.0.4",
|
||||
"debug": "2.6.9",
|
||||
"depd": "2.0.0",
|
||||
"destroy": "1.2.0",
|
||||
"http-errors": "2.0.0",
|
||||
"iconv-lite": "0.4.24",
|
||||
"on-finished": "2.4.1",
|
||||
"qs": "6.11.0",
|
||||
"raw-body": "2.5.1",
|
||||
"type-is": "~1.6.18",
|
||||
"unpipe": "1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8",
|
||||
"npm": "1.2.8000 || >= 1.4.16"
|
||||
}
|
||||
},
|
||||
"node_modules/bytes": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
||||
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bind": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz",
|
||||
"integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==",
|
||||
"dependencies": {
|
||||
"es-define-property": "^1.0.0",
|
||||
"es-errors": "^1.3.0",
|
||||
"function-bind": "^1.1.2",
|
||||
"get-intrinsic": "^1.2.4",
|
||||
"set-function-length": "^1.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/content-disposition": {
|
||||
"version": "0.5.4",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
||||
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "5.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/content-type": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
|
||||
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
|
||||
"integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie-signature": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
||||
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"dependencies": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/define-data-property": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
|
||||
"integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
|
||||
"dependencies": {
|
||||
"es-define-property": "^1.0.0",
|
||||
"es-errors": "^1.3.0",
|
||||
"gopd": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/depd": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
||||
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/destroy": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
|
||||
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
|
||||
"engines": {
|
||||
"node": ">= 0.8",
|
||||
"npm": "1.2.8000 || >= 1.4.16"
|
||||
}
|
||||
},
|
||||
"node_modules/ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
|
||||
},
|
||||
"node_modules/encodeurl": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
|
||||
"integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/es-define-property": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz",
|
||||
"integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==",
|
||||
"dependencies": {
|
||||
"get-intrinsic": "^1.2.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-errors": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/escape-html": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
|
||||
},
|
||||
"node_modules/etag": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
||||
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/express": {
|
||||
"version": "4.18.2",
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
|
||||
"integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==",
|
||||
"dependencies": {
|
||||
"accepts": "~1.3.8",
|
||||
"array-flatten": "1.1.1",
|
||||
"body-parser": "1.20.1",
|
||||
"content-disposition": "0.5.4",
|
||||
"content-type": "~1.0.4",
|
||||
"cookie": "0.5.0",
|
||||
"cookie-signature": "1.0.6",
|
||||
"debug": "2.6.9",
|
||||
"depd": "2.0.0",
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"finalhandler": "1.2.0",
|
||||
"fresh": "0.5.2",
|
||||
"http-errors": "2.0.0",
|
||||
"merge-descriptors": "1.0.1",
|
||||
"methods": "~1.1.2",
|
||||
"on-finished": "2.4.1",
|
||||
"parseurl": "~1.3.3",
|
||||
"path-to-regexp": "0.1.7",
|
||||
"proxy-addr": "~2.0.7",
|
||||
"qs": "6.11.0",
|
||||
"range-parser": "~1.2.1",
|
||||
"safe-buffer": "5.2.1",
|
||||
"send": "0.18.0",
|
||||
"serve-static": "1.15.0",
|
||||
"setprototypeof": "1.2.0",
|
||||
"statuses": "2.0.1",
|
||||
"type-is": "~1.6.18",
|
||||
"utils-merge": "1.0.1",
|
||||
"vary": "~1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/finalhandler": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
|
||||
"integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
|
||||
"dependencies": {
|
||||
"debug": "2.6.9",
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"on-finished": "2.4.1",
|
||||
"parseurl": "~1.3.3",
|
||||
"statuses": "2.0.1",
|
||||
"unpipe": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/forwarded": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/fresh": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
||||
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz",
|
||||
"integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"function-bind": "^1.1.2",
|
||||
"has-proto": "^1.0.1",
|
||||
"has-symbols": "^1.0.3",
|
||||
"hasown": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/gopd": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
|
||||
"integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
|
||||
"dependencies": {
|
||||
"get-intrinsic": "^1.1.3"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/has-property-descriptors": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
|
||||
"integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
|
||||
"dependencies": {
|
||||
"es-define-property": "^1.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/has-proto": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz",
|
||||
"integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/has-symbols": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
||||
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/hasown": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.1.tgz",
|
||||
"integrity": "sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/http-errors": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
|
||||
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
|
||||
"dependencies": {
|
||||
"depd": "2.0.0",
|
||||
"inherits": "2.0.4",
|
||||
"setprototypeof": "1.2.0",
|
||||
"statuses": "2.0.1",
|
||||
"toidentifier": "1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"node_modules/ipaddr.js": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
||||
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/media-typer": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/merge-descriptors": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
||||
"integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
|
||||
},
|
||||
"node_modules/methods": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
||||
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
||||
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
|
||||
"bin": {
|
||||
"mime": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"dependencies": {
|
||||
"mime-db": "1.52.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
|
||||
},
|
||||
"node_modules/negotiator": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
||||
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
"version": "1.13.1",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
|
||||
"integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/on-finished": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
||||
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
|
||||
"dependencies": {
|
||||
"ee-first": "1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/path-to-regexp": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
||||
"integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
|
||||
},
|
||||
"node_modules/proxy-addr": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
||||
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
|
||||
"dependencies": {
|
||||
"forwarded": "0.2.0",
|
||||
"ipaddr.js": "1.9.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.11.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
|
||||
"integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
|
||||
"dependencies": {
|
||||
"side-channel": "^1.0.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/range-parser": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
||||
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/raw-body": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
|
||||
"integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
|
||||
"dependencies": {
|
||||
"bytes": "3.1.2",
|
||||
"http-errors": "2.0.0",
|
||||
"iconv-lite": "0.4.24",
|
||||
"unpipe": "1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"node_modules/send": {
|
||||
"version": "0.18.0",
|
||||
"resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
|
||||
"integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
|
||||
"dependencies": {
|
||||
"debug": "2.6.9",
|
||||
"depd": "2.0.0",
|
||||
"destroy": "1.2.0",
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"fresh": "0.5.2",
|
||||
"http-errors": "2.0.0",
|
||||
"mime": "1.6.0",
|
||||
"ms": "2.1.3",
|
||||
"on-finished": "2.4.1",
|
||||
"range-parser": "~1.2.1",
|
||||
"statuses": "2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/send/node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||
},
|
||||
"node_modules/serve-static": {
|
||||
"version": "1.15.0",
|
||||
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
|
||||
"integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
|
||||
"dependencies": {
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"parseurl": "~1.3.3",
|
||||
"send": "0.18.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/set-function-length": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.1.tgz",
|
||||
"integrity": "sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g==",
|
||||
"dependencies": {
|
||||
"define-data-property": "^1.1.2",
|
||||
"es-errors": "^1.3.0",
|
||||
"function-bind": "^1.1.2",
|
||||
"get-intrinsic": "^1.2.3",
|
||||
"gopd": "^1.0.1",
|
||||
"has-property-descriptors": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/setprototypeof": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
||||
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
|
||||
},
|
||||
"node_modules/side-channel": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.5.tgz",
|
||||
"integrity": "sha512-QcgiIWV4WV7qWExbN5llt6frQB/lBven9pqliLXfGPB+K9ZYXxDozp0wLkHS24kWCm+6YXH/f0HhnObZnZOBnQ==",
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.6",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.4",
|
||||
"object-inspect": "^1.13.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/statuses": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
|
||||
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/toidentifier": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
||||
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/type-is": {
|
||||
"version": "1.6.18",
|
||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
||||
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
||||
"dependencies": {
|
||||
"media-typer": "0.3.0",
|
||||
"mime-types": "~2.1.24"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/utils-merge": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
||||
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"express": "^4.18.2"
|
||||
}
|
||||
}
|
||||
12
build.rs
Normal file
12
build.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
fn main() {
|
||||
let target = std::env::var("TARGET").unwrap();
|
||||
if target == "aarch64-linux-android" {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
println!("cargo:rustc-link-arg=-Wl,-z,max-page-size=65536");
|
||||
|
||||
cc::Build::new()
|
||||
.file("src/log.c")
|
||||
.compile("libc_code.a");
|
||||
println!("cargo:rerun-if-changed=src/log.c");
|
||||
}
|
||||
}
|
||||
60
src/android.rs
Normal file
60
src/android.rs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
use jni::JNIEnv;
|
||||
use jni::objects::{JClass};
|
||||
use jni::sys::{jstring, jboolean};
|
||||
use std::thread;
|
||||
use jni::objects::JString;
|
||||
use crate::{run_server, stop_server};
|
||||
use std::os::raw::c_char;
|
||||
|
||||
#[link(name = "c_code", kind = "static")]
|
||||
unsafe extern "C" {
|
||||
pub fn android_log(tag: *const c_char, message: *const c_char);
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! log_to_logcat {
|
||||
($tag:expr, $($arg:tt)*) => {
|
||||
let log_message = format!($($arg)*);
|
||||
|
||||
let _ = std::panic::catch_unwind(|| {
|
||||
let tag = std::ffi::CString::new($tag).unwrap();
|
||||
let message = std::ffi::CString::new(log_message).unwrap();
|
||||
unsafe {
|
||||
crate::android::android_log(tag.as_ptr(), message.as_ptr());
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
extern "C" fn Java_one_ethanthesleepy_androidew_BackgroundService_startServer<'local>(
|
||||
mut env: JNIEnv<'local>,
|
||||
_class: JClass<'local>,
|
||||
data_path: JString<'local>,
|
||||
easter: jboolean
|
||||
) -> jstring {
|
||||
crate::runtime::set_easter_mode(easter != 0);
|
||||
|
||||
let data_path: String = env.get_string(&data_path).unwrap().into();
|
||||
crate::runtime::update_data_path(&data_path);
|
||||
|
||||
let output = env.new_string(String::from("Azunyannnn~")).unwrap();
|
||||
thread::spawn(|| {
|
||||
run_server(true).unwrap();
|
||||
});
|
||||
log_to_logcat!("ew", "running");
|
||||
output.into_raw()
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
extern "C" fn Java_one_ethanthesleepy_androidew_BackgroundService_stopServer<'local>(env: JNIEnv<'local>, _class: JClass<'local>) -> jstring {
|
||||
stop_server();
|
||||
let output = env.new_string(String::from("I like Yui!")).unwrap();
|
||||
output.into_raw()
|
||||
}
|
||||
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
extern "C" fn Java_one_ethanthesleepy_androidew_BackgroundService_setEasterMode<'local>(_env: JNIEnv<'local>, _class: JClass<'local>, easter: jboolean) {
|
||||
crate::runtime::set_easter_mode(easter != 0);
|
||||
}
|
||||
27
src/ios.rs
Normal file
27
src/ios.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#[cfg(target_os = "ios")]
|
||||
#[unsafe(no_mangle)]
|
||||
#[unsafe(link_section = "__DATA,__mod_init_func")]
|
||||
pub static INITIALIZER: extern "C" fn() = main;
|
||||
|
||||
#[cfg(target_os = "ios")]
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn main() {
|
||||
let data_path = get_bundle_path().into_os_string().into_string().unwrap();
|
||||
crate::runtime::update_data_path(&data_path);
|
||||
|
||||
std::thread::spawn(|| {
|
||||
crate::run_server(true).unwrap();
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(target_os = "ios")]
|
||||
use objc2_foundation::{NSFileManager, NSSearchPathDirectory, NSSearchPathDomainMask};
|
||||
|
||||
#[cfg(target_os = "ios")]
|
||||
pub fn get_bundle_path() -> std::path::PathBuf {
|
||||
unsafe {
|
||||
let manager = NSFileManager::defaultManager();
|
||||
let application_support = manager.URLsForDirectory_inDomains(NSSearchPathDirectory::ApplicationSupportDirectory, NSSearchPathDomainMask::UserDomainMask);
|
||||
return application_support.to_vec_unchecked()[0].to_file_path().unwrap();
|
||||
}
|
||||
}
|
||||
85
src/lib.rs
Normal file
85
src/lib.rs
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
mod static_handlers;
|
||||
mod options;
|
||||
mod router;
|
||||
mod encryption;
|
||||
mod sql;
|
||||
pub mod runtime;
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
|
||||
#[cfg(feature = "library")]
|
||||
#[cfg(target_os = "android")]
|
||||
mod android;
|
||||
|
||||
#[cfg(feature = "library")]
|
||||
#[cfg(target_os = "ios")]
|
||||
mod ios;
|
||||
|
||||
use actix_web::{
|
||||
rt,
|
||||
App,
|
||||
HttpServer,
|
||||
web,
|
||||
dev::Service
|
||||
};
|
||||
use std::time::Duration;
|
||||
pub use options::get_args;
|
||||
use runtime::get_data_path;
|
||||
|
||||
#[actix_web::main]
|
||||
pub async fn run_server(in_thread: bool) -> std::io::Result<()> {
|
||||
let args = get_args();
|
||||
let port = args.port;
|
||||
|
||||
if args.purge {
|
||||
println!("Purging accounts...");
|
||||
let ct = crate::router::userdata::purge_accounts();
|
||||
println!("Purged {} accounts", ct);
|
||||
}
|
||||
|
||||
let rv = HttpServer::new(|| App::new()
|
||||
.wrap_fn(|req, srv| {
|
||||
println!("Request: {} {}", req.method(), req.path());
|
||||
|
||||
#[cfg(feature = "library")]
|
||||
#[cfg(target_os = "android")]
|
||||
log_to_logcat!("ew", "Request: {} {}", req.method(), req.path());
|
||||
|
||||
srv.call(req)
|
||||
})
|
||||
.app_data(web::PayloadConfig::default().limit(1024 * 1024 * 25))
|
||||
.service(static_handlers::css)
|
||||
.service(static_handlers::maintenance)
|
||||
.service(static_handlers::js)
|
||||
.service(static_handlers::files_jp)
|
||||
.service(static_handlers::files_gl)
|
||||
.default_service(web::route().to(router::request))
|
||||
).bind(("0.0.0.0", port))?.run();
|
||||
|
||||
println!("Server started: http://0.0.0.0:{}", port);
|
||||
println!("Data path is set to {}", args.path);
|
||||
println!("Sif1 transfer requests will attempt to contact NPPS4 at {}", args.npps4);
|
||||
|
||||
if args.https {
|
||||
println!("Note: gree is set to https mode. http requests will fail on jp clients.");
|
||||
}
|
||||
|
||||
if in_thread {
|
||||
runtime::set_running(true);
|
||||
let handle = rv.handle();
|
||||
rt::spawn(rv);
|
||||
while runtime::get_running() {
|
||||
actix_web::rt::time::sleep(Duration::from_millis(100)).await;
|
||||
}
|
||||
handle.stop(false).await;
|
||||
println!("Stopped");
|
||||
return Ok(());
|
||||
}
|
||||
rv.await
|
||||
}
|
||||
|
||||
#[actix_web::main]
|
||||
pub async fn stop_server() {
|
||||
runtime::set_running(false);
|
||||
println!("Stopping");
|
||||
}
|
||||
7
src/log.c
Normal file
7
src/log.c
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#include <android/log.h>
|
||||
|
||||
#define LOGI(tag, ...) __android_log_print(ANDROID_LOG_INFO, tag, __VA_ARGS__)
|
||||
|
||||
void android_log(const char* tag, const char* out) {
|
||||
LOGI(tag, "%s", out);
|
||||
}
|
||||
37
src/macros.rs
Normal file
37
src/macros.rs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
// include_file macro: includes a file compressed at compile time, and decompresses it on reference. Decreases binary size
|
||||
#[macro_export]
|
||||
macro_rules! include_file {
|
||||
( $s:expr ) => {
|
||||
{
|
||||
let file = include_flate_codegen::deflate_file!($s);
|
||||
let ret = $crate::macros::decode(file);
|
||||
std::string::String::from_utf8(ret).unwrap()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
pub fn decode(bytes: &[u8]) -> Vec<u8> {
|
||||
use std::io::{Cursor, Read};
|
||||
|
||||
let mut dec = libflate::deflate::Decoder::new(Cursor::new(bytes));
|
||||
let mut ret = Vec::new();
|
||||
dec.read_to_end(&mut ret).unwrap();
|
||||
ret
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! lock_onto_mutex {
|
||||
($mutex:expr) => {{
|
||||
loop {
|
||||
match $mutex.lock() {
|
||||
Ok(value) => {
|
||||
break value;
|
||||
}
|
||||
Err(_) => {
|
||||
$mutex.clear_poison();
|
||||
std::thread::sleep(std::time::Duration::from_millis(15));
|
||||
}
|
||||
}
|
||||
}
|
||||
}};
|
||||
}
|
||||
237
src/main.rs
237
src/main.rs
|
|
@ -1,236 +1,11 @@
|
|||
mod encryption;
|
||||
mod router;
|
||||
mod sql;
|
||||
|
||||
use actix_web::{
|
||||
rt,
|
||||
App,
|
||||
HttpServer,
|
||||
get,
|
||||
HttpResponse,
|
||||
HttpRequest,
|
||||
web,
|
||||
dev::Service,
|
||||
http::header::ContentType
|
||||
};
|
||||
use clap::Parser;
|
||||
use std::fs;
|
||||
use std::sync::Mutex;
|
||||
use std::time::Duration;
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
#[get("/index.css")]
|
||||
async fn css(_req: HttpRequest) -> HttpResponse {
|
||||
HttpResponse::Ok()
|
||||
.insert_header(ContentType(mime::TEXT_CSS))
|
||||
.body(include_file!("webui/dist/index.css"))
|
||||
}
|
||||
#[get("/index.js")]
|
||||
async fn js(_req: HttpRequest) -> HttpResponse {
|
||||
HttpResponse::Ok()
|
||||
.insert_header(ContentType(mime::APPLICATION_JAVASCRIPT_UTF_8))
|
||||
.body(include_file!("webui/dist/index.js"))
|
||||
}
|
||||
#[get("/maintenance/maintenance.json")]
|
||||
async fn maintenance(_req: HttpRequest) -> HttpResponse {
|
||||
HttpResponse::Ok()
|
||||
.insert_header(ContentType(mime::APPLICATION_JSON))
|
||||
.body(r#"{"opened_at":"2024-02-05 02:00:00","closed_at":"2024-02-05 04:00:00","message":":(","server":1,"gamelib":0}"#)
|
||||
}
|
||||
fn handle_assets(req: HttpRequest) -> HttpResponse {
|
||||
HttpResponse::SeeOther()
|
||||
.insert_header(("location", format!("https://sif2.sif.moe{}", req.path())))
|
||||
.body("")
|
||||
}
|
||||
#[get("/Android/{hash}/{file}")]
|
||||
async fn files_jp(req: HttpRequest) -> HttpResponse {
|
||||
handle_assets(req)
|
||||
}
|
||||
|
||||
#[get("/Android/{lang}/{hash}/{file}")]
|
||||
async fn files_gl(req: HttpRequest) -> HttpResponse {
|
||||
handle_assets(req)
|
||||
}
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
pub struct Args {
|
||||
#[arg(short, long, default_value_t = 8080, help = "Port to listen on")]
|
||||
port: u16,
|
||||
|
||||
#[arg(long, default_value = "./", help = "Path to store database files")]
|
||||
path: String,
|
||||
|
||||
#[arg(long, default_value_t = false, help = "Serve gree headers with https. WILL NOT ACCEPT HTTPS REQUESTS")]
|
||||
https: bool,
|
||||
|
||||
#[arg(long, default_value = "http://127.0.0.1:51376", help = "Address to NPPS4 server for sif account linking")]
|
||||
npps4: String,
|
||||
|
||||
//below options are for the "Help" page
|
||||
|
||||
#[arg(long, default_value = "", help = "Link to patched android global apk for this server.")]
|
||||
global_android: String,
|
||||
|
||||
#[arg(long, default_value = "", help = "Link to patched android japan apk for this server.")]
|
||||
japan_android: String,
|
||||
|
||||
#[arg(long, default_value = "", help = "Link to patched iOS global apk for this server.")]
|
||||
global_ios: String,
|
||||
|
||||
#[arg(long, default_value = "", help = "Link to patched iOS japan apk for this server.")]
|
||||
japan_ios: String,
|
||||
|
||||
#[arg(long, default_value = "", help = "Link to asset server.")]
|
||||
assets_url: String,
|
||||
|
||||
#[arg(long, default_value_t = 0, help = "Max time returned by the server, in the JSON \"timestamp\" key.")]
|
||||
max_time: u64,
|
||||
|
||||
#[arg(long, default_value_t = false, help = "Disable webui, act completely like the original server")]
|
||||
hidden: bool,
|
||||
|
||||
#[arg(long, default_value_t = false, help = "Purge dead user accounts on startup")]
|
||||
purge: bool,
|
||||
|
||||
#[arg(long, default_value_t = false, help = "Disable user account imports")]
|
||||
disable_imports: bool,
|
||||
|
||||
#[arg(long, default_value_t = false, help = "Disable user account exports")]
|
||||
disable_exports: bool,
|
||||
|
||||
#[arg(long, default_value = "", help = "Asset hash for English iOS client.")]
|
||||
en_ios_asset_hash: String,
|
||||
|
||||
#[arg(long, default_value = "", help = "Asset hash for JP iOS client.")]
|
||||
jp_ios_asset_hash: String,
|
||||
|
||||
#[arg(long, default_value = "", help = "Asset hash for English Android client.")]
|
||||
en_android_asset_hash: String,
|
||||
|
||||
#[arg(long, default_value = "", help = "Asset hash for JP Android client.")]
|
||||
jp_android_asset_hash: String
|
||||
}
|
||||
|
||||
#[actix_web::main]
|
||||
async fn run_server(in_thread: bool) -> std::io::Result<()> {
|
||||
let args = get_args();
|
||||
let port = args.port;
|
||||
|
||||
if args.purge {
|
||||
println!("Purging accounts...");
|
||||
let ct = crate::router::userdata::purge_accounts();
|
||||
println!("Purged {} accounts", ct);
|
||||
}
|
||||
|
||||
let rv = HttpServer::new(|| App::new()
|
||||
.wrap_fn(|req, srv| {
|
||||
println!("Request: {}", req.path());
|
||||
srv.call(req)
|
||||
})
|
||||
.app_data(web::PayloadConfig::default().limit(1024 * 1024 * 25))
|
||||
.service(css)
|
||||
.service(maintenance)
|
||||
.service(js)
|
||||
.service(files_jp)
|
||||
.service(files_gl)
|
||||
.default_service(web::route().to(router::request))
|
||||
).bind(("0.0.0.0", port))?.run();
|
||||
|
||||
println!("Server started: http://0.0.0.0:{}", port);
|
||||
println!("Data path is set to {}", args.path);
|
||||
println!("Sif1 transfer requests will attempt to contact NPPS4 at {}", args.npps4);
|
||||
|
||||
if args.https {
|
||||
println!("Note: gree is set to https mode. http requests will fail on jp clients.");
|
||||
}
|
||||
|
||||
if in_thread {
|
||||
set_running(true).await;
|
||||
let handle = rv.handle();
|
||||
rt::spawn(rv);
|
||||
while get_running().await {
|
||||
actix_web::rt::time::sleep(Duration::from_millis(100)).await;
|
||||
}
|
||||
handle.stop(false).await;
|
||||
println!("Stopped");
|
||||
return Ok(());
|
||||
}
|
||||
rv.await
|
||||
}
|
||||
|
||||
#[actix_web::main]
|
||||
async fn stop_server() {
|
||||
set_running(false).await;
|
||||
println!("Stopping");
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "library"))]
|
||||
fn main() -> std::io::Result<()> {
|
||||
run_server(false)
|
||||
ew::runtime::update_data_path(&ew::get_args().path);
|
||||
ew::run_server(false)
|
||||
}
|
||||
|
||||
pub fn get_args() -> Args {
|
||||
Args::parse()
|
||||
}
|
||||
|
||||
pub fn get_data_path(file_name: &str) -> String {
|
||||
let args = get_args();
|
||||
let mut path = args.path;
|
||||
while path.ends_with('/') {
|
||||
path.pop();
|
||||
}
|
||||
fs::create_dir_all(&path).unwrap();
|
||||
format!("{}/{}", path, file_name)
|
||||
}
|
||||
|
||||
// include_file macro: includes a file compressed at compile time, and decompresses it on reference. Decreases binary size
|
||||
#[macro_export]
|
||||
macro_rules! include_file {
|
||||
( $s:expr ) => {
|
||||
{
|
||||
let file = include_flate_codegen::deflate_file!($s);
|
||||
let ret = $crate::decode(file);
|
||||
std::string::String::from_utf8(ret).unwrap()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
pub fn decode(bytes: &[u8]) -> Vec<u8> {
|
||||
use std::io::{Cursor, Read};
|
||||
|
||||
let mut dec = libflate::deflate::Decoder::new(Cursor::new(bytes));
|
||||
let mut ret = Vec::new();
|
||||
dec.read_to_end(&mut ret).unwrap();
|
||||
ret
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! lock_onto_mutex {
|
||||
($mutex:expr) => {{
|
||||
loop {
|
||||
match $mutex.lock() {
|
||||
Ok(value) => {
|
||||
break value;
|
||||
}
|
||||
Err(_) => {
|
||||
$mutex.clear_poison();
|
||||
actix_web::rt::time::sleep(std::time::Duration::from_millis(15)).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref RUNNING: Mutex<bool> = Mutex::new(false);
|
||||
}
|
||||
|
||||
async fn set_running(running: bool) {
|
||||
let mut result = lock_onto_mutex!(RUNNING);
|
||||
*result = running;
|
||||
}
|
||||
|
||||
async fn get_running() -> bool {
|
||||
let result = lock_onto_mutex!(RUNNING);
|
||||
*result
|
||||
#[cfg(feature = "library")]
|
||||
fn main() {
|
||||
panic!("Compiled with the library feature! You should load the shared object library and call the exported methods there.");
|
||||
}
|
||||
|
|
|
|||
65
src/options.rs
Normal file
65
src/options.rs
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
use clap::Parser;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
pub struct Args {
|
||||
#[arg(short, long, default_value_t = 8080, help = "Port to listen on")]
|
||||
pub port: u16,
|
||||
|
||||
#[arg(long, default_value = "./", help = "Path to store database files")]
|
||||
pub path: String,
|
||||
|
||||
#[arg(long, default_value_t = false, help = "Serve gree headers with https. WILL NOT ACCEPT HTTPS REQUESTS")]
|
||||
pub https: bool,
|
||||
|
||||
#[arg(long, default_value = "http://127.0.0.1:51376", help = "Address to NPPS4 server for sif account linking")]
|
||||
pub npps4: String,
|
||||
|
||||
//below options are for the "Help" page
|
||||
|
||||
#[arg(long, default_value = "", help = "Link to patched android global apk for this server.")]
|
||||
pub global_android: String,
|
||||
|
||||
#[arg(long, default_value = "", help = "Link to patched android japan apk for this server.")]
|
||||
pub japan_android: String,
|
||||
|
||||
#[arg(long, default_value = "", help = "Link to patched iOS global apk for this server.")]
|
||||
pub global_ios: String,
|
||||
|
||||
#[arg(long, default_value = "", help = "Link to patched iOS japan apk for this server.")]
|
||||
pub japan_ios: String,
|
||||
|
||||
#[arg(long, default_value = "", help = "Link to asset server.")]
|
||||
pub assets_url: String,
|
||||
|
||||
#[arg(long, default_value_t = 0, help = "Max time returned by the server, in the JSON \"timestamp\" key.")]
|
||||
pub max_time: u64,
|
||||
|
||||
#[arg(long, default_value_t = false, help = "Disable webui, act completely like the original server")]
|
||||
pub hidden: bool,
|
||||
|
||||
#[arg(long, default_value_t = false, help = "Purge dead user accounts on startup")]
|
||||
pub purge: bool,
|
||||
|
||||
#[arg(long, default_value_t = false, help = "Disable user account imports")]
|
||||
pub disable_imports: bool,
|
||||
|
||||
#[arg(long, default_value_t = false, help = "Disable user account exports")]
|
||||
pub disable_exports: bool,
|
||||
|
||||
#[arg(long, default_value = "", help = "Asset hash for English iOS client.")]
|
||||
pub en_ios_asset_hash: String,
|
||||
|
||||
#[arg(long, default_value = "", help = "Asset hash for JP iOS client.")]
|
||||
pub jp_ios_asset_hash: String,
|
||||
|
||||
#[arg(long, default_value = "", help = "Asset hash for English Android client.")]
|
||||
pub en_android_asset_hash: String,
|
||||
|
||||
#[arg(long, default_value = "", help = "Asset hash for JP Android client.")]
|
||||
pub jp_android_asset_hash: String
|
||||
}
|
||||
|
||||
pub fn get_args() -> Args {
|
||||
Args::parse()
|
||||
}
|
||||
|
|
@ -8,6 +8,29 @@ use crate::encryption;
|
|||
use crate::sql::SQLite;
|
||||
use crate::router::{global, databases};
|
||||
|
||||
trait SqlClearRate {
|
||||
fn get_live_data(&self, id: i64) -> Result<Live, rusqlite::Error>;
|
||||
}
|
||||
impl SqlClearRate for SQLite {
|
||||
fn get_live_data(&self, id: i64) -> Result<Live, rusqlite::Error> {
|
||||
let conn = rusqlite::Connection::open(self.get_path()).unwrap();
|
||||
let mut stmt = conn.prepare("SELECT * FROM lives WHERE live_id=?1")?;
|
||||
stmt.query_row(params!(id), |row| {
|
||||
Ok(Live {
|
||||
live_id: row.get(0)?,
|
||||
normal_failed: row.get(1)?,
|
||||
normal_pass: row.get(2)?,
|
||||
hard_failed: row.get(3)?,
|
||||
hard_pass: row.get(4)?,
|
||||
expert_failed: row.get(5)?,
|
||||
expert_pass: row.get(6)?,
|
||||
master_failed: row.get(7)?,
|
||||
master_pass: row.get(8)?,
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref DATABASE: SQLite = SQLite::new("live_statistics.db", setup_tables);
|
||||
static ref CACHED_DATA: Mutex<Option<JsonValue>> = Mutex::new(None);
|
||||
|
|
@ -25,8 +48,8 @@ pub struct Live {
|
|||
pub master_pass: i64,
|
||||
}
|
||||
|
||||
fn setup_tables(conn: &SQLite) {
|
||||
conn.lock_and_exec("CREATE TABLE IF NOT EXISTS lives (
|
||||
fn setup_tables(conn: &rusqlite::Connection) {
|
||||
conn.execute_batch("CREATE TABLE IF NOT EXISTS lives (
|
||||
live_id INT NOT NULL PRIMARY KEY,
|
||||
normal_failed BIGINT NOT NULL,
|
||||
normal_pass BIGINT NOT NULL,
|
||||
|
|
@ -36,11 +59,11 @@ fn setup_tables(conn: &SQLite) {
|
|||
expert_pass BIGINT NOT NULL,
|
||||
master_failed BIGINT NOT NULL,
|
||||
master_pass BIGINT NOT NULL
|
||||
)", params!());
|
||||
conn.lock_and_exec("CREATE TABLE IF NOT EXISTS scores (
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS scores (
|
||||
live_id INT NOT NULL PRIMARY KEY,
|
||||
score_data TEXT NOT NULL
|
||||
)", params!());
|
||||
);").unwrap();
|
||||
}
|
||||
|
||||
fn update_live_score(id: i64, uid: i64, score: i64) {
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ lazy_static! {
|
|||
static ref CACHED_DATA: Mutex<Option<JsonValue>> = Mutex::new(None);
|
||||
}
|
||||
|
||||
fn setup_tables(conn: &SQLite) {
|
||||
conn.lock_and_exec("CREATE TABLE IF NOT EXISTS scores (
|
||||
fn setup_tables(conn: &rusqlite::Connection) {
|
||||
conn.execute_batch("CREATE TABLE IF NOT EXISTS scores (
|
||||
event_id INT NOT NULL PRIMARY KEY,
|
||||
score_data TEXT NOT NULL
|
||||
)", params!());
|
||||
);").unwrap();
|
||||
}
|
||||
|
||||
pub fn live_completed(event_id: u32, uid: i64, score: i64, star_level: i64) {
|
||||
|
|
|
|||
|
|
@ -9,40 +9,54 @@ use uuid::Uuid;
|
|||
|
||||
use crate::encryption;
|
||||
use crate::router::{userdata, gree, items};
|
||||
use crate::runtime::get_easter_mode;
|
||||
|
||||
pub const ASSET_VERSION: &str = "5260ff15dff8ba0c00ad91400f515f55";
|
||||
pub const ASSET_HASH_ANDROID: &str = "d210b28037885f3ef56b8f8aa45ac95b";
|
||||
pub const ASSET_HASH_IOS: &str = "dd7175e4bcdab476f38c33c7f34b5e4d";
|
||||
pub const ASSET_VERSION_GL: &str = "5260ff15dff8ba0c00ad91400f515f55";
|
||||
pub const ASSET_HASH_ANDROID_GL: &str = "d210b28037885f3ef56b8f8aa45ac95b";
|
||||
pub const ASSET_HASH_IOS_GL: &str = "dd7175e4bcdab476f38c33c7f34b5e4d";
|
||||
|
||||
pub const ASSET_VERSION_JP: &str = "4c921d2443335e574a82e04ec9ea243c";
|
||||
pub const ASSET_HASH_ANDROID_JP: &str = "67f8f261c16b3cca63e520a25aad6c1c";
|
||||
pub const ASSET_HASH_IOS_JP: &str = "b8975be8300013a168d061d3fdcd4a16";
|
||||
pub const ASSET_VERSION_JP: &str = "4c921d2443335e574a82e04ec9ea243c";
|
||||
pub const ASSET_HASH_ANDROID_JP: &str = "67f8f261c16b3cca63e520a25aad6c1c";
|
||||
pub const ASSET_HASH_IOS_JP: &str = "b8975be8300013a168d061d3fdcd4a16";
|
||||
|
||||
pub const ASSET_HASH_ANDROID_EASTER_GL: &str = "da7ae831381c3f29337caa9891db7e6a";
|
||||
pub const ASSET_HASH_ANDROID_EASTER_JP: &str = "eac0cad61c82bf2e31fc596555747d11";
|
||||
|
||||
pub fn get_asset_hash(asset_version: String, android: bool) -> String {
|
||||
let args = crate::get_args();
|
||||
if asset_version == ASSET_VERSION_JP {
|
||||
if android {
|
||||
if android {
|
||||
if asset_version == ASSET_VERSION_JP {
|
||||
if args.jp_android_asset_hash != String::new() {
|
||||
args.jp_android_asset_hash
|
||||
&args.jp_android_asset_hash
|
||||
} else if get_easter_mode() {
|
||||
ASSET_HASH_ANDROID_EASTER_JP
|
||||
} else {
|
||||
ASSET_HASH_ANDROID_JP.to_string()
|
||||
ASSET_HASH_ANDROID_JP
|
||||
}
|
||||
} else if args.jp_ios_asset_hash != String::new() {
|
||||
args.jp_ios_asset_hash
|
||||
} else {
|
||||
ASSET_HASH_IOS_JP.to_string()
|
||||
if args.en_android_asset_hash != String::new() {
|
||||
&args.en_android_asset_hash
|
||||
} else if get_easter_mode() {
|
||||
ASSET_HASH_ANDROID_EASTER_GL
|
||||
} else {
|
||||
ASSET_HASH_ANDROID_GL
|
||||
}
|
||||
}
|
||||
} else if android {
|
||||
if args.en_android_asset_hash != String::new() {
|
||||
args.en_android_asset_hash
|
||||
} else {
|
||||
ASSET_HASH_ANDROID.to_string()
|
||||
}
|
||||
} else if args.en_ios_asset_hash != String::new() {
|
||||
args.en_ios_asset_hash
|
||||
} else {
|
||||
ASSET_HASH_IOS.to_string()
|
||||
}
|
||||
if asset_version == ASSET_VERSION_JP {
|
||||
if args.jp_ios_asset_hash != String::new() {
|
||||
&args.jp_ios_asset_hash
|
||||
} else {
|
||||
ASSET_HASH_IOS_JP
|
||||
}
|
||||
} else {
|
||||
if args.en_ios_asset_hash != String::new() {
|
||||
&args.en_ios_asset_hash
|
||||
} else {
|
||||
ASSET_HASH_IOS_GL
|
||||
}
|
||||
}
|
||||
}.to_string()
|
||||
}
|
||||
|
||||
pub fn create_token() -> String {
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ lazy_static! {
|
|||
static ref DATABASE: SQLite = SQLite::new("gree.db", setup_tables);
|
||||
}
|
||||
|
||||
fn setup_tables(conn: &SQLite) {
|
||||
conn.create_store_v2("CREATE TABLE IF NOT EXISTS users (
|
||||
fn setup_tables(conn: &rusqlite::Connection) {
|
||||
conn.execute_batch("CREATE TABLE IF NOT EXISTS users (
|
||||
cert TEXT NOT NULL,
|
||||
uuid TEXT NOT NULL,
|
||||
user_id BIGINT NOT NULL PRIMARY KEY
|
||||
)");
|
||||
);").unwrap();
|
||||
}
|
||||
|
||||
fn update_cert(uid: i64, cert: &str) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use crate::encryption;
|
|||
use crate::router::{userdata, global};
|
||||
|
||||
fn get_asset_hash(req: &HttpRequest, body: &JsonValue) -> String {
|
||||
if body["asset_version"] != global::ASSET_VERSION && body["asset_version"] != global::ASSET_VERSION_JP {
|
||||
if body["asset_version"] != global::ASSET_VERSION_GL && body["asset_version"] != global::ASSET_VERSION_JP {
|
||||
println!("Warning! Asset version is not what was expected. (Did the app update?)");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,62 +17,63 @@ lazy_static! {
|
|||
};
|
||||
}
|
||||
|
||||
fn setup_tables(conn: &SQLite) {
|
||||
conn.create_store_v2("CREATE TABLE IF NOT EXISTS tokens (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
token TEXT NOT NULL
|
||||
)");
|
||||
conn.create_store_v2("CREATE TABLE IF NOT EXISTS migration (
|
||||
token TEXT NOT NULL PRIMARY KEY,
|
||||
password TEXT NOT NULL
|
||||
)");
|
||||
|
||||
conn.create_store_v2("CREATE TABLE IF NOT EXISTS userdata (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
userdata TEXT NOT NULL,
|
||||
friend_request_disabled INT NOT NULL
|
||||
)");
|
||||
conn.create_store_v2("CREATE TABLE IF NOT EXISTS userhome (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
userhome TEXT NOT NULL
|
||||
)");
|
||||
conn.create_store_v2("CREATE TABLE IF NOT EXISTS missions (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
missions TEXT NOT NULL
|
||||
)");
|
||||
conn.create_store_v2("CREATE TABLE IF NOT EXISTS loginbonus (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
loginbonus TEXT NOT NULL
|
||||
)");
|
||||
conn.create_store_v2("CREATE TABLE IF NOT EXISTS sifcards (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
sifcards TEXT NOT NULL
|
||||
)");
|
||||
conn.create_store_v2("CREATE TABLE IF NOT EXISTS friends (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
friends TEXT NOT NULL
|
||||
)");
|
||||
conn.create_store_v2("CREATE TABLE IF NOT EXISTS chats (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
chats TEXT NOT NULL
|
||||
)");
|
||||
conn.create_store_v2("CREATE TABLE IF NOT EXISTS event (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
event TEXT NOT NULL
|
||||
)");
|
||||
conn.create_store_v2("CREATE TABLE IF NOT EXISTS eventloginbonus (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
eventloginbonus TEXT NOT NULL
|
||||
)");
|
||||
conn.create_store_v2("CREATE TABLE IF NOT EXISTS server_data (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
server_data TEXT NOT NULL
|
||||
)");
|
||||
conn.create_store_v2("CREATE TABLE IF NOT EXISTS webui (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
token TEXT NOT NULL,
|
||||
last_login BIGINT NOT NULL
|
||||
)");
|
||||
fn setup_tables(conn: &rusqlite::Connection) {
|
||||
conn.execute_batch("
|
||||
CREATE TABLE IF NOT EXISTS tokens (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
token TEXT NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS migration (
|
||||
token TEXT NOT NULL PRIMARY KEY,
|
||||
password TEXT NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS userdata (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
userdata TEXT NOT NULL,
|
||||
friend_request_disabled INT NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS userhome (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
userhome TEXT NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS missions (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
missions TEXT NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS loginbonus (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
loginbonus TEXT NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS sifcards (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
sifcards TEXT NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS friends (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
friends TEXT NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS chats (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
chats TEXT NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS event (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
event TEXT NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS eventloginbonus (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
eventloginbonus TEXT NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS server_data (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
server_data TEXT NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS webui (
|
||||
user_id BIGINT NOT NULL PRIMARY KEY,
|
||||
token TEXT NOT NULL,
|
||||
last_login BIGINT NOT NULL
|
||||
);
|
||||
").unwrap();
|
||||
}
|
||||
|
||||
fn acc_exists(uid: i64) -> bool {
|
||||
|
|
|
|||
44
src/runtime.rs
Normal file
44
src/runtime.rs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
use lazy_static::lazy_static;
|
||||
use std::sync::RwLock;
|
||||
use std::fs;
|
||||
|
||||
lazy_static! {
|
||||
static ref RUNNING: RwLock<bool> = RwLock::new(false);
|
||||
static ref DATAPATH: RwLock<String> = RwLock::new(String::new());
|
||||
static ref EASTER: RwLock<bool> = RwLock::new(false);
|
||||
}
|
||||
|
||||
pub fn set_running(running: bool) {
|
||||
let mut w = RUNNING.write().unwrap();
|
||||
*w = running;
|
||||
}
|
||||
|
||||
pub fn get_running() -> bool {
|
||||
*RUNNING.read().unwrap()
|
||||
}
|
||||
|
||||
pub fn get_data_path(file_name: &str) -> String {
|
||||
let mut path = {
|
||||
DATAPATH.read().unwrap().clone()
|
||||
};
|
||||
while path.ends_with('/') {
|
||||
path.pop();
|
||||
}
|
||||
fs::create_dir_all(&path).unwrap();
|
||||
format!("{}/{}", path, file_name)
|
||||
}
|
||||
|
||||
pub fn update_data_path(path: &str) {
|
||||
let mut w = DATAPATH.write().unwrap();
|
||||
*w = path.to_string();
|
||||
}
|
||||
|
||||
// Only currently editable by the android so
|
||||
pub fn set_easter_mode(enabled: bool) {
|
||||
let mut w = EASTER.write().unwrap();
|
||||
*w = enabled;
|
||||
}
|
||||
|
||||
pub fn get_easter_mode() -> bool {
|
||||
*EASTER.read().unwrap()
|
||||
}
|
||||
65
src/sql.rs
65
src/sql.rs
|
|
@ -1,45 +1,30 @@
|
|||
use rusqlite::{Connection, params, ToSql};
|
||||
use std::sync::Mutex;
|
||||
use rusqlite::{Connection, ToSql};
|
||||
use json::{JsonValue, array};
|
||||
|
||||
use crate::router::clear_rate::Live;
|
||||
|
||||
macro_rules! lock_onto_mutex {
|
||||
($mutex:expr) => {{
|
||||
loop {
|
||||
match $mutex.lock() {
|
||||
Ok(value) => {
|
||||
break value;
|
||||
}
|
||||
Err(_) => {
|
||||
$mutex.clear_poison();
|
||||
std::thread::sleep(std::time::Duration::from_millis(10));
|
||||
}
|
||||
}
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
pub struct SQLite {
|
||||
engine: Mutex<Connection>
|
||||
path: String
|
||||
}
|
||||
|
||||
impl SQLite {
|
||||
pub fn new(path: &str, setup: fn(&SQLite)) -> SQLite {
|
||||
let conn = Connection::open(crate::get_data_path(path)).unwrap();
|
||||
conn.execute("PRAGMA foreign_keys = ON;", ()).unwrap();
|
||||
pub fn new(path: &str, setup: fn(&Connection)) -> SQLite {
|
||||
let instance = SQLite {
|
||||
engine: Mutex::new(conn)
|
||||
path: crate::get_data_path(path)
|
||||
};
|
||||
setup(&instance);
|
||||
let conn = Connection::open(&instance.path).unwrap();
|
||||
conn.busy_timeout(std::time::Duration::from_secs(10)).unwrap();
|
||||
conn.execute("PRAGMA foreign_keys = ON;", ()).unwrap();
|
||||
setup(&conn);
|
||||
instance
|
||||
}
|
||||
pub fn get_path(&self) -> &str {
|
||||
&self.path
|
||||
}
|
||||
pub fn lock_and_exec(&self, command: &str, args: &[&dyn ToSql]) {
|
||||
let conn = lock_onto_mutex!(self.engine);
|
||||
let conn = Connection::open(&self.path).unwrap();
|
||||
conn.execute(command, args).unwrap();
|
||||
}
|
||||
pub fn lock_and_select(&self, command: &str, args: &[&dyn ToSql]) -> Result<String, rusqlite::Error> {
|
||||
let conn = lock_onto_mutex!(self.engine);
|
||||
let conn = Connection::open(&self.path).unwrap();
|
||||
let mut stmt = conn.prepare(command)?;
|
||||
stmt.query_row(args, |row| {
|
||||
match row.get::<usize, i64>(0) {
|
||||
|
|
@ -49,7 +34,7 @@ impl SQLite {
|
|||
})
|
||||
}
|
||||
pub fn lock_and_select_all(&self, command: &str, args: &[&dyn ToSql]) -> Result<JsonValue, rusqlite::Error> {
|
||||
let conn = lock_onto_mutex!(self.engine);
|
||||
let conn = Connection::open(&self.path).unwrap();
|
||||
let mut stmt = conn.prepare(command)?;
|
||||
let map = stmt.query_map(args, |row| {
|
||||
match row.get::<usize, i64>(0) {
|
||||
|
|
@ -62,29 +47,9 @@ impl SQLite {
|
|||
let res = val?;
|
||||
match res.clone().parse::<i64>() {
|
||||
Ok(v) => rv.push(v).unwrap(),
|
||||
Err(_) => rv.push(res).unwrap()
|
||||
Err(_) => rv.push(res).unwrap()
|
||||
};
|
||||
}
|
||||
Ok(rv)
|
||||
}
|
||||
pub fn get_live_data(&self, id: i64) -> Result<Live, rusqlite::Error> {
|
||||
let conn = lock_onto_mutex!(self.engine);
|
||||
let mut stmt = conn.prepare("SELECT * FROM lives WHERE live_id=?1")?;
|
||||
stmt.query_row(params!(id), |row| {
|
||||
Ok(Live {
|
||||
live_id: row.get(0)?,
|
||||
normal_failed: row.get(1)?,
|
||||
normal_pass: row.get(2)?,
|
||||
hard_failed: row.get(3)?,
|
||||
hard_pass: row.get(4)?,
|
||||
expert_failed: row.get(5)?,
|
||||
expert_pass: row.get(6)?,
|
||||
master_failed: row.get(7)?,
|
||||
master_pass: row.get(8)?,
|
||||
})
|
||||
})
|
||||
}
|
||||
pub fn create_store_v2(&self, table: &str) {
|
||||
self.lock_and_exec(table, params!());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
51
src/static_handlers.rs
Normal file
51
src/static_handlers.rs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
use actix_web::{
|
||||
get,
|
||||
HttpResponse,
|
||||
HttpRequest,
|
||||
http::header::ContentType
|
||||
};
|
||||
use std::fs;
|
||||
use crate::include_file;
|
||||
|
||||
#[get("/index.css")]
|
||||
async fn css(_req: HttpRequest) -> HttpResponse {
|
||||
HttpResponse::Ok()
|
||||
.insert_header(ContentType(mime::TEXT_CSS))
|
||||
.body(include_file!("webui/dist/index.css"))
|
||||
}
|
||||
#[get("/index.js")]
|
||||
async fn js(_req: HttpRequest) -> HttpResponse {
|
||||
HttpResponse::Ok()
|
||||
.insert_header(ContentType(mime::APPLICATION_JAVASCRIPT_UTF_8))
|
||||
.body(include_file!("webui/dist/index.js"))
|
||||
}
|
||||
#[get("/maintenance/maintenance.json")]
|
||||
async fn maintenance(_req: HttpRequest) -> HttpResponse {
|
||||
HttpResponse::Ok()
|
||||
.insert_header(ContentType(mime::APPLICATION_JSON))
|
||||
.body(r#"{"opened_at":"2024-02-05 02:00:00","closed_at":"2024-02-05 04:00:00","message":":(","server":1,"gamelib":0}"#)
|
||||
}
|
||||
|
||||
fn handle_assets(req: HttpRequest) -> HttpResponse {
|
||||
let file_path = format!("assets{}", req.path());
|
||||
let exists = fs::exists(&file_path);
|
||||
|
||||
if exists.unwrap_or(false) {
|
||||
let resp = fs::read(&file_path).unwrap();
|
||||
return HttpResponse::Ok()
|
||||
.body(resp)
|
||||
}
|
||||
|
||||
HttpResponse::SeeOther()
|
||||
.insert_header(("location", format!("https://sif2.sif.moe{}", req.path())))
|
||||
.body("")
|
||||
}
|
||||
#[get("/Android/{hash}/{file}")]
|
||||
async fn files_jp(req: HttpRequest) -> HttpResponse {
|
||||
handle_assets(req)
|
||||
}
|
||||
|
||||
#[get("/Android/{lang}/{hash}/{file}")]
|
||||
async fn files_gl(req: HttpRequest) -> HttpResponse {
|
||||
handle_assets(req)
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue