Compare commits

..

No commits in common. "main" and "1.4.3" have entirely different histories.
main ... 1.4.3

16 changed files with 355 additions and 2376 deletions

View file

@ -17,24 +17,14 @@ jobs:
rust_target: aarch64-pc-windows-msvc
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust_target }}
- name: Cache cargo dependencies
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
LoaderSpot_UI/target
LoaderSpot_CLI/target
key: ${{ runner.os }}-cargo-${{ matrix.rust_target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.rust_target }}-
- name: Install Rust toolchain and target
shell: pwsh
run: |
rustup toolchain install stable --profile minimal
rustup target add ${{ matrix.rust_target }}
rustup default stable
- name: Build release binaries
env:
@ -42,87 +32,93 @@ jobs:
ARCH: ${{ matrix.arch }}
shell: pwsh
run: |
# fail on first error
$ErrorActionPreference = "Stop"
# prepare artifacts folder
$out = "artifacts"
if (Test-Path $out) { Remove-Item $out -Recurse -Force }
New-Item -ItemType Directory -Path $out | Out-Null
Write-Host "Building UI for $env:RUST_TARGET"
# build UI
Write-Host "Building UI for target: $env:RUST_TARGET"
cargo build --manifest-path LoaderSpot_UI/Cargo.toml --release --target $env:RUST_TARGET
$exeUI = Get-ChildItem "LoaderSpot_UI/target/$env:RUST_TARGET/release/*.exe" | Select-Object -First 1
Copy-Item $exeUI.FullName "$out\loaderspot-ui-win-$env:ARCH.exe"
Write-Host "UI executable ready: loaderspot-ui-win-$env:ARCH.exe"
Write-Host "Building CLI for $env:RUST_TARGET"
$exePathUI = Join-Path -Path "LoaderSpot_UI" -ChildPath (Join-Path -Path "target" -ChildPath (Join-Path -Path $env:RUST_TARGET -ChildPath "release"))
$exeUI = Get-ChildItem -Path $exePathUI -Filter "*.exe" -File | Select-Object -First 1
Copy-Item $exeUI.FullName -Destination "$out\loaderspot_ui_$env:ARCH.exe" -Force
Write-Host "UI executable ready: $out\loaderspot_ui_$env:ARCH.exe"
# build CLI
Write-Host "Building CLI for target: $env:RUST_TARGET"
cargo build --manifest-path LoaderSpot_CLI/Cargo.toml --release --target $env:RUST_TARGET
$exeCLI = Get-ChildItem "LoaderSpot_CLI/target/$env:RUST_TARGET/release/*.exe" | Select-Object -First 1
Copy-Item $exeCLI.FullName "$out\loaderspot-cli-win-$env:ARCH.exe"
Write-Host "CLI executable ready: loaderspot-cli-win-$env:ARCH.exe"
$exePathCLI = Join-Path -Path "LoaderSpot_CLI" -ChildPath (Join-Path -Path "target" -ChildPath (Join-Path -Path $env:RUST_TARGET -ChildPath "release"))
$exeCLI = Get-ChildItem -Path $exePathCLI -Filter "*.exe" -File | Select-Object -First 1
Copy-Item $exeCLI.FullName -Destination "$out\loaderspot_cli_$env:ARCH.exe" -Force
Write-Host "CLI executable ready: $out\loaderspot_cli_$env:ARCH.exe"
- name: Upload Windows artifacts
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@v5
with:
name: windows-artifacts-${{ matrix.arch }}
path: artifacts/*
path: |
artifacts/loaderspot_ui_${{ matrix.arch }}.exe
artifacts/loaderspot_cli_${{ matrix.arch }}.exe
build_linux:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: x64
rust_target: x86_64-unknown-linux-gnu
- arch: arm64
rust_target: aarch64-unknown-linux-gnu
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
- name: Cache cargo dependencies
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
LoaderSpot_UI/target
LoaderSpot_CLI/target
key: ${{ runner.os }}-cargo-x86_64-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-x86_64-
- name: Install Rust toolchain and target
run: |
rustup toolchain install stable --profile minimal
rustup target add ${{ matrix.rust_target }}
rustup default stable
- name: Install build dependencies
- name: Install cross-compilation tools
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev
if [ "${{ matrix.rust_target }}" = "aarch64-unknown-linux-gnu" ]; then
sudo apt-get install -y gcc-aarch64-linux-gnu
fi
- name: Build release binaries
- name: Build release binary
env:
RUST_TARGET: ${{ matrix.rust_target }}
ARCH: ${{ matrix.arch }}
run: |
# Set linker for cross-compilation
if [ "$RUST_TARGET" = "aarch64-unknown-linux-gnu" ]; then
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
fi
mkdir -p artifacts
# Build UI for Linux
echo "Building UI for x86_64-unknown-linux-gnu"
cargo build --manifest-path LoaderSpot_UI/Cargo.toml --release --target x86_64-unknown-linux-gnu
cp "LoaderSpot_UI/target/x86_64-unknown-linux-gnu/release/loaderspot_ui" "artifacts/loaderspot-ui-linux-x64"
echo "UI executable ready: loaderspot-ui-linux-x64"
# Build CLI for Linux
echo "Building CLI for x86_64-unknown-linux-gnu"
cargo build --manifest-path LoaderSpot_CLI/Cargo.toml --release --target x86_64-unknown-linux-gnu
cp "LoaderSpot_CLI/target/x86_64-unknown-linux-gnu/release/loaderspot_cli" "artifacts/loaderspot-cli-linux-x64"
echo "CLI executable ready: loaderspot-cli-linux-x64"
# build CLI
echo "Building CLI for target: $RUST_TARGET"
cargo build --manifest-path LoaderSpot_CLI/Cargo.toml --release --target $RUST_TARGET
cp "LoaderSpot_CLI/target/$RUST_TARGET/release/loaderspot_cli" "artifacts/loaderspot_cli_linux_$ARCH"
echo "CLI executable ready: artifacts/loaderspot_cli_linux_$ARCH"
- name: Upload Linux artifacts
uses: actions/upload-artifact@v7
- name: Upload Linux artifact
uses: actions/upload-artifact@v5
with:
name: linux-artifacts-x64
path: artifacts/*
name: linux-artifacts-${{ matrix.arch }}
path: artifacts/loaderspot_cli_linux_${{ matrix.arch }}
release:
needs: [build_windows, build_linux]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v8
uses: actions/download-artifact@v4
with:
path: artifacts
@ -131,15 +127,14 @@ jobs:
uses: actions/github-script@v8
with:
script: |
try {
const release = await github.rest.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo
});
return release.data.id;
} catch (error) {
core.setFailed(`No releases found: ${error.message}`);
const releases = await github.rest.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo
});
if (!releases.data || releases.data.length === 0) {
core.setFailed('No releases found for repository');
}
return releases.data[0].id;
- name: Upload assets to Release
uses: actions/github-script@v8
@ -169,7 +164,7 @@ jobs:
});
}
console.log(`Uploading: ${fileName}`);
console.log(`Uploading new asset: ${fileName}`);
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
@ -179,17 +174,10 @@ jobs:
});
}
const files = [];
const artifactDirs = fs.readdirSync('artifacts');
for (const dir of artifactDirs) {
const dirPath = path.join('artifacts', dir);
const dirFiles = fs.readdirSync(dirPath);
for (const file of dirFiles) {
files.push(path.join(dirPath, file));
const files = fs.readdirSync(path.join('artifacts', dir));
for (const file of files) {
await uploadAsset(path.join('artifacts', dir, file));
}
}
for (let i = 0; i < files.length; i += 3) {
const batch = files.slice(i, i + 3);
await Promise.all(batch.map(uploadAsset));
}

View file

@ -13,7 +13,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v5
with:
token: ${{ secrets.PERSONAL_TOKEN }}

View file

@ -1,6 +1,8 @@
name: check Spotify MS
on:
schedule:
- cron: '0 */5 * * *'
workflow_dispatch:
jobs:
@ -9,7 +11,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v6
uses: actions/checkout@v5
- name: run ms-spotify-check.ps1
shell: pwsh

View file

@ -1,15 +1,13 @@
name: Sync files to table
on:
# Temporarily disabled automatic sync trigger.
# Uncomment this block to restore automatic runs on push to main.
# push:
# branches:
# - main
# paths:
# - 'versions.json'
# - 'versions_deb.json'
workflow_dispatch:
push:
branches:
- main
paths:
- 'versions.json'
- 'versions_deb.json'
workflow_dispatch:
jobs:
sync-files:
@ -19,10 +17,10 @@ jobs:
steps:
- name: Checkout source repo
uses: actions/checkout@v6
uses: actions/checkout@v5
- name: Checkout target repo
uses: actions/checkout@v6
uses: actions/checkout@v5
with:
repository: LoaderSpot/table
path: table

View file

@ -8,11 +8,7 @@ on:
required: true
version:
description: 'Another version parameter'
required: true
buildType:
description: 'Build type (e.g., Master, Release)'
required: false
default: 'false'
required: true
jobs:
update-version:
runs-on: ubuntu-latest
@ -21,7 +17,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v5
with:
token: ${{ secrets.PERSONAL_TOKEN }}
@ -33,8 +29,7 @@ jobs:
- name: Update version in versions.json
run: |
data="${{ github.event.inputs.datajson }}"
build_type="${{ github.event.inputs.buildType }}"
python3 update_version.py "$data" "$build_type"
python3 -c "import json, re; data=json.loads('$data'); file_data=json.load(open('versions.json')); file_data[list(data.keys())[0]] = data[list(data.keys())[0]]; file_data = dict(sorted(file_data.items(), key=lambda x: [int(part) if part.isdigit() else part for part in re.split(r'(\d+)', x[0])], reverse=True)); json.dump(file_data, open('versions.json', 'w'), indent=2)"
- name: Commit changes
run: |

View file

@ -8,47 +8,29 @@ concurrency:
cancel-in-progress: false
jobs:
version-search:
build:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.search.outputs.versions }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v5
- name: Download latest loaderspot_cli_linux_x64
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release download --repo ${{ github.repository }} --pattern "loaderspot-cli-linux-x64" --output loaderspot_cli
chmod +x loaderspot_cli
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
LoaderSpot_CLI/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('LoaderSpot_CLI/Cargo.lock') }}
- name: Build LoaderSpot_CLI
run: cd LoaderSpot_CLI && cargo build --release
- name: Version search
id: search
if: github.event.client_payload.v && github.event.client_payload.s
env:
v: ${{ github.event.client_payload.v }}
s: ${{ github.event.client_payload.s }}
run: |
{
echo 'versions<<EOF'
./loaderspot_cli --version "$v" --connections 300 --ladder-search
echo 'EOF'
} >> "$GITHUB_OUTPUT"
get-build-and-send:
runs-on: windows-latest
needs: version-search
if: success() && needs.version-search.outputs.versions
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Get build info and send to GAS
shell: pwsh
env:
GOOGLE_APPS_URL: ${{ secrets.GOOGLE_APPS_URL }}
VERSIONS: ${{ needs.version-search.outputs.versions }}
SOURCE: ${{ github.event.client_payload.s }}
run: |
./check-build-version.ps1 -versions "$env:VERSIONS" -source "$env:SOURCE" -googleAppsUrl "$env:GOOGLE_APPS_URL"
run: ${{ github.workspace }}/LoaderSpot_CLI/target/release/loaderspot_cli --version "${{ github.event.client_payload.v }}" --source "${{ github.event.client_payload.s }}" --gas-url "${{ secrets.GOOGLE_APPS_URL }}" --connections 300

2
.gitignore vendored
View file

@ -1,2 +0,0 @@
/LoaderSpot_CLI/target
/LoaderSpot_UI/target

View file

@ -7,6 +7,7 @@ use std::sync::Arc;
use std::time::Duration;
use tokio::sync::Semaphore;
use regex::Regex;
use scraper::{Html, Selector};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize)]
enum PlatformArch {
@ -148,9 +149,13 @@ struct Cli {
#[clap(long, default_value_t = 100)]
connections: usize,
/// Use ladder search algorithm
/// URL to send the found versions to (Google Apps Script)
#[clap(long)]
ladder_search: bool,
gas_url: Option<String>,
/// Source of the version
#[clap(long)]
source: Option<String>,
}
fn parse_range(range_str: &str) -> (i32, i32) {
@ -215,7 +220,7 @@ async fn main() {
let connections = cli.connections.clamp(50, 300);
let range = cli.range.clone();
let client = Client::builder()
.timeout(std::time::Duration::from_secs(30))
.timeout(std::time::Duration::from_secs(10))
.build()
.unwrap();
@ -226,42 +231,43 @@ async fn main() {
pb.set_style(spinner_style);
pb.enable_steady_tick(Duration::from_millis(80));
let versions = cli.version.clone();
let version_clone = cli.version.clone();
let client_clone = client.clone();
let ladder_search = cli.ladder_search;
let versions_clone_for_task = versions.clone();
let gas_url_clone = cli.gas_url.clone();
let source_clone = cli.source.clone();
let search_task = tokio::spawn(async move {
let mut results = Vec::new();
let mut all_found_urls = Vec::new();
for version in &versions_clone_for_task {
let mut all_found_urls_for_version = Vec::new();
for version in &version_clone {
let mut arches_to_search = platform_arches.clone();
if !should_use_win_x86(version) && arches_to_search.contains(&PlatformArch::WinX86) {
if versions_clone_for_task.len() == 1 && arches_to_search.len() == 1 {
if version_clone.len() == 1 && arches_to_search.len() == 1 {
eprintln!("Warning: x86 architecture for Windows is no longer supported for versions newer than 1.2.53.");
continue;
}
arches_to_search.retain(|&p| p != PlatformArch::WinX86);
}
if ladder_search {
if gas_url_clone.is_some() && source_clone.is_some() {
// "Лесенка"
let mut start_number = 0;
let mut before_enter = 1000;
let additional_searches = 15;
let increment = 1000;
// Первый проход
for &platform_arch in &arches_to_search {
let found = search_installers(&client_clone, version, start_number, before_enter, platform_arch, connections).await;
all_found_urls_for_version.extend(found);
all_found_urls.extend(found);
}
// Дополнительные поиски
for _ in 0..additional_searches {
let latest_urls = get_latest_urls(&all_found_urls_for_version);
let latest_urls = get_latest_urls(&all_found_urls, &[version.to_string()], source_clone.as_deref().unwrap_or(""));
let target_len = arches_to_search.iter().filter(|&&p| p != PlatformArch::WinX86 || should_use_win_x86(version)).count();
if latest_urls.len() >= target_len {
if latest_urls.len() >= target_len + 2 { // +2 for version and source
break;
}
@ -274,40 +280,55 @@ async fn main() {
missing_arches.push(platform_arch);
}
}
for &platform_arch in &missing_arches {
let found = search_installers(&client_clone, version, start_number, before_enter, platform_arch, connections).await;
all_found_urls_for_version.extend(found);
all_found_urls.extend(found);
}
}
} else {
// Стандартный поиск
let (start, end) = parse_range(&range);
for &platform_arch in &arches_to_search {
let found = search_installers(&client_clone, version, start, end, platform_arch, connections).await;
all_found_urls_for_version.extend(found);
all_found_urls.extend(found);
}
}
let mut latest_urls = get_latest_urls(&all_found_urls_for_version);
latest_urls.insert("version".to_string(), version.clone());
results.push(latest_urls);
}
results
all_found_urls
});
let results = search_task.await.unwrap();
let all_found_urls = search_task.await.unwrap();
pb.finish_and_clear();
if versions.len() == 1 {
let json_output = serde_json::to_string_pretty(&results[0]).unwrap();
println!("{}", json_output);
} else {
let json_output = serde_json::to_string_pretty(&results).unwrap();
println!("{}", json_output);
match (&cli.gas_url, &cli.source) {
(Some(gas_url), Some(source)) => {
let latest_urls = get_latest_urls(&all_found_urls, &cli.version, source);
send_to_gas(client, gas_url, latest_urls).await;
}
(Some(_), None) => {
eprintln!("Warning: --gas-url is provided, but --source is missing. Skipping sending to GAS.");
let json_output = serde_json::to_string_pretty(&all_found_urls).unwrap();
println!("{}", json_output);
}
(None, Some(_)) => {
eprintln!("Warning: --source is provided, but --gas-url is missing. Skipping sending to GAS.");
let json_output = serde_json::to_string_pretty(&all_found_urls).unwrap();
println!("{}", json_output);
}
(None, None) => {
let json_output = serde_json::to_string_pretty(&all_found_urls).unwrap();
println!("{}", json_output);
}
}
}
fn get_latest_urls(found_urls: &[(String, PlatformArch)]) -> HashMap<String, String> {
fn get_latest_urls(
found_urls: &[(String, PlatformArch)],
versions: &[String],
source: &str,
) -> HashMap<String, String> {
let mut platform_urls = HashMap::new();
let version_pattern = Regex::new(r"-(\d+)\.(exe|tbz)$").unwrap();
@ -326,16 +347,62 @@ fn get_latest_urls(found_urls: &[(String, PlatformArch)]) -> HashMap<String, Str
}
}
let latest_urls: HashMap<String, String> = platform_urls
let mut latest_urls: HashMap<String, String> = platform_urls
.into_iter()
.map(|(k, (v, _))| (k, v))
.collect();
if !versions.is_empty() {
latest_urls.insert("version".to_string(), versions.join(", "));
}
latest_urls.insert("source".to_string(), source.to_string());
if latest_urls.is_empty() {
let mut empty_map = HashMap::new();
empty_map.insert("unknown".to_string(), "unknown".to_string());
if !versions.is_empty() {
empty_map.insert("version".to_string(), versions.join(", "));
}
empty_map.insert("source".to_string(), source.to_string());
return empty_map;
}
latest_urls
}
async fn send_to_gas(
client: Client,
gas_url: &str,
data: HashMap<String, String>,
) {
let cleaned_gas_url = gas_url.trim_matches('"');
match client.post(cleaned_gas_url).json(&data).send().await {
Ok(response) => {
if response.status().is_success() {
match response.text().await {
Ok(text) => {
if text.contains("<div") {
let soup = Html::parse_document(&text);
let selector = Selector::parse("div[style*='text-align:center']").unwrap();
if let Some(div) = soup.select(&selector).next() {
println!("Ответ от GAS: {}", div.text().collect::<String>().trim());
} else {
eprintln!("Не удалось извлечь ответ из HTML. Полный ответ:");
eprintln!("{}", text);
}
} else {
println!("Ответ от GAS: {}", text.trim());
}
}
Err(e) => eprintln!("Ошибка чтения ответа от GAS: {}", e),
}
} else {
eprintln!("Ошибка при отправке в GAS: {}", response.status());
}
}
Err(e) => eprintln!("Ошибка при отправке запроса в GAS: {}", e),
}
}

View file

@ -762,15 +762,6 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.21"
@ -1901,21 +1892,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092"
[[package]]
name = "loaderspot_ui"
version = "0.1.0"
dependencies = [
"crossbeam-channel",
"eframe",
"egui",
"regex",
"reqwest",
"serde",
"serde_json",
"tokio",
"winapi",
]
[[package]]
name = "lock_api"
version = "0.4.14"
@ -3211,6 +3187,20 @@ dependencies = [
"bitflags 2.10.0",
]
[[package]]
name = "spotify_finder"
version = "0.1.0"
dependencies = [
"eframe",
"egui",
"regex",
"reqwest",
"serde",
"serde_json",
"tokio",
"winapi",
]
[[package]]
name = "stable_deref_trait"
version = "1.2.1"

View file

@ -1,5 +1,5 @@
[package]
name = "loaderspot_ui"
name = "spotify_finder"
version = "0.1.0"
edition = "2021"
@ -11,7 +11,4 @@ reqwest = { version = "0.12", features = ["json"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
regex = "1.10"
crossbeam-channel = "0.5"
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["winuser"] }
winapi = { version = "0.3", features = ["winuser"] }

View file

@ -1,13 +1,13 @@
// Hide console window on Windows
#![cfg_attr(target_os = "windows", windows_subsystem = "windows")]
use crossbeam_channel::{unbounded, Receiver, Sender};
use eframe::egui;
use reqwest::Client;
use serde::Deserialize;
use std::collections::{HashMap, VecDeque};
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
use std::sync::{Arc, OnceLock};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::{channel, Receiver, Sender};
use std::sync::{Arc, Mutex};
use std::time::Instant;
use tokio::runtime::Runtime;
@ -31,13 +31,13 @@ impl Platform {
}
}
fn generate_path(&self, version: &str, number: i32) -> String {
fn path_template(&self) -> &str {
match self {
Platform::WinX86 => format!("win32-x86/spotify_installer-{version}-{number}.exe"),
Platform::WinX64 => format!("win32-x86_64/spotify_installer-{version}-{number}.exe"),
Platform::WinArm64 => format!("win32-arm64/spotify_installer-{version}-{number}.exe"),
Platform::MacOsIntel => format!("osx-x86_64/spotify-autoupdate-{version}-{number}.tbz"),
Platform::MacOsArm64 => format!("osx-arm64/spotify-autoupdate-{version}-{number}.tbz"),
Platform::WinX86 => "win32-x86/spotify_installer-{version}-{number}.exe",
Platform::WinX64 => "win32-x86_64/spotify_installer-{version}-{number}.exe",
Platform::WinArm64 => "win32-arm64/spotify_installer-{version}-{number}.exe",
Platform::MacOsIntel => "osx-x86_64/spotify-autoupdate-{version}-{number}.tbz",
Platform::MacOsArm64 => "osx-arm64/spotify-autoupdate-{version}-{number}.tbz",
}
}
@ -63,11 +63,11 @@ impl UrlGenerator {
const BASE_URL: &'static str = "https://upgrade.scdn.co/upgrade/client/";
fn generate_url(platform: Platform, version: &str, number: i32) -> String {
format!(
"{}{}",
Self::BASE_URL,
platform.generate_path(version, number)
)
let path = platform
.path_template()
.replace("{version}", version)
.replace("{number}", &number.to_string());
format!("{}{}", Self::BASE_URL, path)
}
}
@ -83,12 +83,15 @@ fn extract_base_version(version: &str) -> String {
#[allow(dead_code)]
fn should_use_win_x86(version: &str) -> bool {
let mut parts = version.split('.');
let base_version = extract_base_version(version);
let parts: Vec<&str> = base_version.split('.').collect();
if let (Some(p1), Some(p2), Some(p3)) = (parts.next(), parts.next(), parts.next()) {
if let (Ok(major), Ok(minor), Ok(patch)) =
(p1.parse::<u32>(), p2.parse::<u32>(), p3.parse::<u32>())
{
if parts.len() >= 3 {
if let (Ok(major), Ok(minor), Ok(patch)) = (
parts[0].parse::<u32>(),
parts[1].parse::<u32>(),
parts[2].parse::<u32>(),
) {
return (major, minor, patch) <= (1, 2, 53);
}
}
@ -96,8 +99,7 @@ fn should_use_win_x86(version: &str) -> bool {
}
fn validate_version(version: &str) -> bool {
static RE: OnceLock<regex::Regex> = OnceLock::new();
let re = RE.get_or_init(|| regex::Regex::new(r"^\d+\.\d+\.\d+\.\d+\.g[0-9a-f]{8}$").unwrap());
let re = regex::Regex::new(r"^\d+\.\d+\.\d+\.\d+\.g[0-9a-f]{8}$").unwrap();
re.is_match(version)
}
@ -115,23 +117,8 @@ const MAX_CONNECTION_OPTIONS: [usize; 6] = [50, 100, 150, 200, 250, 300];
async fn check_url(client: &Client, url: String, platform: Platform) -> Option<(String, Platform)> {
match client.head(&url).send().await {
Ok(response) => {
if response.status().is_success() {
Some((url, platform))
} else if response.status() == reqwest::StatusCode::TOO_MANY_REQUESTS {
eprintln!(
"RATE LIMITED (429)! Server blocked the request for: {}",
url
);
None
} else {
None
}
}
Err(e) => {
eprintln!("Network error: {}", e);
None
}
Ok(response) if response.status().is_success() => Some((url, platform)),
_ => None,
}
}
@ -164,7 +151,7 @@ async fn check_version_and_submit(client: &Client, version: &str) {
let version_exists = versions_json
.values()
.any(|v| v.fullversion.as_ref().is_some_and(|fv| fv == version));
.any(|v| v.fullversion.as_ref().map_or(false, |fv| fv == version));
if !version_exists {
submit_to_google_form(client, version).await;
@ -172,15 +159,16 @@ async fn check_version_and_submit(client: &Client, version: &str) {
}
enum SearchMessage {
Progress(u64, u64),
Result(String, Platform),
Complete(String),
VersionStart(String, usize, usize),
CompleteAll,
}
struct SearchOptions {
client: Client,
version: String,
async fn search_installers(
client: &Client,
version: &str,
start: i32,
end: i32,
platforms: Vec<Platform>,
@ -188,59 +176,45 @@ struct SearchOptions {
tx: Sender<SearchMessage>,
pause_flag: Arc<AtomicBool>,
cancel_flag: Arc<AtomicBool>,
processed: Arc<AtomicU64>,
}
async fn search_installers(opts: SearchOptions) {
) {
use tokio::sync::Semaphore;
let semaphore = Arc::new(Semaphore::new(opts.max_connections));
let total = ((end - start + 1) * platforms.len() as i32) as u64;
let semaphore = Arc::new(Semaphore::new(max_connections));
let mut tasks = Vec::new();
let processed = Arc::new(Mutex::new(0u64));
'outer: for platform in opts.platforms {
for number in opts.start..=opts.end {
if opts.cancel_flag.load(Ordering::Relaxed) {
break 'outer;
}
while opts.pause_flag.load(Ordering::Relaxed) {
if opts.cancel_flag.load(Ordering::Relaxed) {
break 'outer;
}
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
}
let permit = match semaphore.clone().acquire_owned().await {
Ok(p) => p,
Err(_) => break 'outer,
};
while opts.pause_flag.load(Ordering::Relaxed) {
if opts.cancel_flag.load(Ordering::Relaxed) {
break 'outer;
}
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
}
if opts.cancel_flag.load(Ordering::Relaxed) {
break 'outer;
}
let url = UrlGenerator::generate_url(platform, &opts.version, number);
let client = opts.client.clone();
let tx_clone = opts.tx.clone();
let processed_clone = opts.processed.clone();
let cancel_local = opts.cancel_flag.clone();
for platform in platforms {
for number in start..=end {
let url = UrlGenerator::generate_url(platform, version, number);
let client = client.clone();
let permit = semaphore.clone().acquire_owned().await.unwrap();
let tx_clone = tx.clone();
let processed_clone = processed.clone();
let pause_local = pause_flag.clone();
let cancel_local = cancel_flag.clone();
let task = tokio::spawn(async move {
let _permit = permit;
if cancel_local.load(Ordering::Relaxed) {
return;
}
while pause_local.load(Ordering::Relaxed) {
if cancel_local.load(Ordering::Relaxed) {
return;
}
tokio::time::sleep(std::time::Duration::from_millis(200)).await;
}
let result = check_url(&client, url, platform).await;
processed_clone.fetch_add(1, Ordering::Relaxed);
drop(permit);
let mut p = processed_clone.lock().unwrap();
*p += 1;
let current = *p;
drop(p);
let _ = tx_clone.send(SearchMessage::Progress(current, total));
if let Some((url, platform)) = result {
let _ = tx_clone.send(SearchMessage::Result(url, platform));
@ -251,17 +225,11 @@ async fn search_installers(opts: SearchOptions) {
}
}
if opts.cancel_flag.load(Ordering::Relaxed) {
for task in &tasks {
task.abort();
}
}
for task in tasks {
let _ = task.await;
}
let _ = opts.tx.send(SearchMessage::Complete(opts.version));
let _ = tx.send(SearchMessage::Complete(version.to_string()));
}
struct SpotifyFinderApp {
@ -279,6 +247,7 @@ struct SpotifyFinderApp {
report_unknown: bool,
search_results: String,
is_searching: bool,
is_paused: bool,
displayed_results: String,
@ -293,8 +262,7 @@ struct SpotifyFinderApp {
progress: f32,
progress_text: String,
total_work: u64,
processed_global: Arc<AtomicU64>,
processed_global: u64,
rx: Option<Receiver<SearchMessage>>,
found_urls: HashMap<Platform, Vec<String>>,
@ -316,6 +284,7 @@ impl Default for SpotifyFinderApp {
platform_macos_intel: false,
platform_macos_arm64: false,
report_unknown: false,
search_results: String::new(),
is_searching: false,
is_paused: false,
displayed_results: String::new(),
@ -327,7 +296,7 @@ impl Default for SpotifyFinderApp {
progress: 0.0,
progress_text: String::new(),
total_work: 0,
processed_global: Arc::new(AtomicU64::new(0)),
processed_global: 0,
rx: None,
found_urls: HashMap::new(),
pause_flag: Arc::new(AtomicBool::new(false)),
@ -340,6 +309,7 @@ impl Default for SpotifyFinderApp {
}
impl SpotifyFinderApp {
// Improved reveal logic: finish current item immediately and fast-forward the queue
fn advance_reveal(&mut self) {
if self.current_reveal.is_some() && !self.reveal_queue.is_empty() {
if let Some(cur) = self.current_reveal.take() {
@ -466,6 +436,7 @@ impl SpotifyFinderApp {
self.is_searching = true;
self.progress = 0.0;
self.progress_text = "Starting...".to_string();
self.search_results.clear();
self.displayed_results.clear();
self.reveal_queue.clear();
self.current_reveal = None;
@ -480,15 +451,13 @@ impl SpotifyFinderApp {
let per_version = ((end - start + 1) * cnt as i32) as u64;
total_work_calc = total_work_calc.saturating_add(per_version);
}
self.total_work = total_work_calc;
self.processed_global.store(0, Ordering::Relaxed);
self.processed_global = 0;
self.current_version = None;
self.current_version_index = 0;
self.total_versions = versions.len();
let (tx, rx): (Sender<SearchMessage>, Receiver<SearchMessage>) = unbounded();
let (tx, rx) = channel();
self.rx = Some(rx);
self.pause_flag.store(false, Ordering::Relaxed);
@ -500,7 +469,6 @@ impl SpotifyFinderApp {
let pause = self.pause_flag.clone();
let cancel = self.cancel_flag.clone();
let base_platforms_for_spawn = base_platforms.clone();
let processed_for_spawn = self.processed_global.clone();
self.runtime.spawn(async move {
let client = Client::builder()
@ -534,18 +502,17 @@ impl SpotifyFinderApp {
continue;
}
search_installers(SearchOptions {
client: client.clone(),
version,
search_installers(
&client,
&version,
start,
end,
platforms: platforms_for_version,
max_connections: max_conn,
tx: tx.clone(),
pause_flag: pause.clone(),
cancel_flag: cancel.clone(),
processed: processed_for_spawn.clone(),
})
platforms_for_version,
max_conn,
tx.clone(),
pause.clone(),
cancel.clone(),
)
.await;
if cancel.load(Ordering::Relaxed) {
@ -567,6 +534,7 @@ impl SpotifyFinderApp {
}
fn clear_results(&mut self) {
self.search_results.clear();
self.displayed_results.clear();
self.reveal_queue.clear();
self.current_reveal = None;
@ -574,49 +542,49 @@ impl SpotifyFinderApp {
self.progress = 0.0;
self.progress_text.clear();
self.total_work = 0;
self.processed_global.store(0, Ordering::Relaxed);
self.processed_global = 0;
}
fn update_search_progress(&mut self) {
let current_processed = self.processed_global.load(Ordering::Relaxed);
let denom = if self.total_work == 0 {
1
} else {
self.total_work
};
self.progress = current_processed as f32 / denom as f32;
if let Some(v) = &self.current_version {
let short = short_version(v);
if self.total_versions > 1 {
self.progress_text = format!(
"Checking: {}/{}, Version: {}, No. {}/{}",
current_processed,
denom,
short,
self.current_version_index,
self.total_versions
);
} else {
self.progress_text = format!(
"Checking: {}/{}, Version: {}",
current_processed, denom, short
);
}
} else if self.is_searching {
self.progress_text = format!("Checking: {}/{}", current_processed, denom);
}
if let Some(rx_owned) = self.rx.take() {
let rx = rx_owned;
let mut completed = false;
let mut processed_this_frame = 0;
while let Ok(msg) = rx_owned.try_recv() {
processed_this_frame += 1;
while let Ok(msg) = rx.try_recv() {
match msg {
SearchMessage::Progress(_current, _total) => {
self.processed_global = self.processed_global.saturating_add(1);
let denom = if self.total_work == 0 {
1
} else {
self.total_work
};
self.progress = self.processed_global as f32 / denom as f32;
if let Some(v) = &self.current_version {
let short = short_version(v);
if self.total_versions > 1 {
self.progress_text = format!(
"Checking: {}/{}, Version: {}, No. {}/{}",
self.processed_global,
denom,
short,
self.current_version_index,
self.total_versions
);
} else {
self.progress_text = format!(
"Checking: {}/{}, Version: {}",
self.processed_global, denom, short
);
}
} else {
self.progress_text =
format!("Checking: {}/{}", self.processed_global, denom);
}
}
SearchMessage::Result(url, platform) => {
let entry = self.found_urls.entry(platform).or_default();
let entry = self.found_urls.entry(platform).or_insert_with(Vec::new);
let first = entry.is_empty();
entry.push(url.clone());
@ -658,14 +626,10 @@ impl SpotifyFinderApp {
completed = true;
}
}
if processed_this_frame > 1000 && !completed {
break;
}
}
if !completed {
self.rx = Some(rx_owned);
self.rx = Some(rx);
}
}
}
@ -990,13 +954,15 @@ impl eframe::App for SpotifyFinderApp {
self.is_paused = false;
self.pause_flag.store(false, Ordering::Relaxed);
}
} else if ui
.add_sized(btn_size, egui::Button::new("⏸ Pause"))
.clicked()
{
self.is_paused = true;
self.pause_flag.store(true, Ordering::Relaxed);
self.progress_text = "Paused".to_string();
} else {
if ui
.add_sized(btn_size, egui::Button::new("⏸ Pause"))
.clicked()
{
self.is_paused = true;
self.pause_flag.store(true, Ordering::Relaxed);
self.progress_text = "Paused".to_string();
}
}
if ui
@ -1005,11 +971,13 @@ impl eframe::App for SpotifyFinderApp {
{
self.stop_search();
}
} else if ui
.add_sized(btn_size, egui::Button::new("▶ Start Search"))
.clicked()
{
self.start_search();
} else {
if ui
.add_sized(btn_size, egui::Button::new("▶ Start Search"))
.clicked()
{
self.start_search();
}
}
ui.add_enabled_ui(!self.is_searching, |ui| {

View file

@ -1,125 +0,0 @@
param (
[string]$versions,
[string]$source,
[string]$googleAppsUrl
)
function Find-BuildInfo {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true, ValueFromPipeline=$true, Position=0)]
[string]$Path
)
process {
try {
$fileContent = Get-Content -Path $Path -ErrorAction Stop
$found = $false
$regex = '(Master|Release|PR|Local) Build.+(?:cef_)?(\d+\.\d+\.\d+\+g[0-9a-f]+\+chromium-\d+\.\d+\.\d+\.\d+)'
foreach ($line in $fileContent) {
$match = [regex]::Match($line, $regex)
if ($match.Success) {
$buildType = $match.Groups[1].Value
Write-Host "build type: $buildType"
return $buildType
}
}
if (-not $found) {
Write-Host "Билд не найден"
return $false
}
}
catch {
Write-Error "Ошибка при чтении файла: $_"
return $false
}
}
}
function Get-BuildTypeFromUrl {
[CmdletBinding()]
param(
[string]$Url
)
$tempPath = Join-Path ([System.IO.Path]::GetTempPath()) "spotify"
$destinationPath = Join-Path $tempPath "unpacked"
$exePath = Join-Path $tempPath "SpotifySetup.exe"
if (-not (Test-Path -Path $tempPath)) {
New-Item -ItemType Directory -Path $tempPath | Out-Null
}
if (-not (Test-Path -Path $destinationPath)) {
New-Item -ItemType Directory -Path $destinationPath | Out-Null
}
try {
Write-Host "Скачивание файла из $Url..."
Invoke-WebRequest -Uri $Url -OutFile $exePath
Write-Host "Файл сохранен в $exePath"
Write-Host "Распаковка файла в $destinationPath"
Start-Process -Wait -FilePath $exePath -ArgumentList "/extract `"$destinationPath`""
$dllPath = Join-Path $destinationPath "Spotify.dll"
$exePathForAnalysis = Join-Path $destinationPath "Spotify.exe"
if (Test-Path $dllPath) {
return Find-BuildInfo -Path $dllPath
} elseif (Test-Path $exePathForAnalysis) {
return Find-BuildInfo -Path $exePathForAnalysis
}
else {
Write-Error "Файлы Spotify.dll и Spotify.exe не найдены в $destinationPath"
return $false
}
}
catch {
Write-Error "Произошла ошибка при скачивании или распаковке: $_"
return $false
}
}
if ([string]::IsNullOrEmpty($versions) -or [string]::IsNullOrEmpty($source) -or [string]::IsNullOrEmpty($googleAppsUrl)) {
Write-Error "Один или несколько обязательных параметров (versions, source, googleAppsUrl) не предоставлены."
exit 1
}
$versionsObj = $versions | ConvertFrom-Json
$win64Url = $versionsObj.WIN64
$buildType = $false
if ($win64Url) {
$buildType = Get-BuildTypeFromUrl -Url $win64Url
}
if ($buildType -eq $false) {
$versionsObj | Add-Member -NotePropertyName "buildType" -NotePropertyValue $false -Force
} else {
$versionsObj | Add-Member -NotePropertyName "buildType" -NotePropertyValue $buildType -Force
}
$versionsObj | Add-Member -NotePropertyName "source" -NotePropertyValue $source -Force
$finalJson = $versionsObj | ConvertTo-Json -Compress
Write-Host "Отправка данных на GAS..."
try {
$response = Invoke-WebRequest -Uri $googleAppsUrl `
-Method POST `
-ContentType "application/json" `
-Body $finalJson `
-UseBasicParsing -ErrorAction Stop
if ($response.StatusCode -eq 200) {
Write-Host "Ответ от GAS: $($response.Content)"
} else {
Write-Error "Ошибка при отправке в GAS. Статус: $($response.StatusCode). Ответ: $($response.Content)"
}
} catch {
Write-Error "Критическая ошибка при отправке в GAS: $_"
}

View file

@ -123,9 +123,9 @@ def commit_changes(new_versions):
# Формируем сообщение коммита в зависимости от количества новых версий
if new_versions:
commit_message = (
f"Added deb version {new_versions[0][1]}"
f"Added deb version {new_versions[0][0]}"
if len(new_versions) == 1
else f"Added deb versions: {', '.join(v[1] for v in new_versions)}"
else f"Added deb versions: {', '.join(v[0] for v in new_versions)}"
)
else:
commit_message = "Update Spotify versions"

View file

@ -1,63 +0,0 @@
#!/usr/bin/env python3
import json
import re
import sys
def update_version(data_json: str, build_type: str = None, version_file: str = "versions.json") -> bool:
try:
data = json.loads(data_json)
version_key = list(data.keys())[0]
version_data = data[version_key]
if build_type and build_type.lower() != 'false':
version_data = {'buildType': build_type, **version_data}
with open(version_file, 'r', encoding='utf-8') as f:
file_data = json.load(f)
file_data[version_key] = version_data
sorted_data = dict(
sorted(
file_data.items(),
key=lambda x: [
int(part) if part.isdigit() else part
for part in re.split(r'(\d+)', x[0])
],
reverse=True
)
)
with open(version_file, 'w', encoding='utf-8') as f:
json.dump(sorted_data, f, indent=2)
print(f"Version {version_key} added to {version_file}")
return True
except json.JSONDecodeError as e:
print(f"JSON parse error: {e}", file=sys.stderr)
return False
except FileNotFoundError:
print(f"File {version_file} not found", file=sys.stderr)
return False
except Exception as e:
print(f"Error: {e}", file=sys.stderr)
return False
def main():
if len(sys.argv) < 2:
print("Usage: python update_version.py '<json_data>' [build_type] [version_file]", file=sys.stderr)
sys.exit(1)
data_json = sys.argv[1]
build_type = sys.argv[2] if len(sys.argv) > 2 else None
version_file = sys.argv[3] if len(sys.argv) > 3 else "versions.json"
success = update_version(data_json, build_type, version_file)
sys.exit(0 if success else 1)
if __name__ == "__main__":
main()

File diff suppressed because it is too large Load diff

View file

@ -1,44 +1,4 @@
{
"1.2.84.476": {
"fullversion": "1.2.84.476.ga1ff6607",
"size": "157643240",
"data": "09.03.2026",
"links": {
"amd64": "https://github.com/LoaderSpot/deb-builds/releases/download/builds/spotify-client_1.2.84.476.ga1ff6607_amd64.deb"
}
},
"1.2.82.428": {
"fullversion": "1.2.82.428.g0ac8be2b",
"size": "156375346",
"data": "09.02.2026",
"links": {
"amd64": "https://github.com/LoaderSpot/deb-builds/releases/download/builds/spotify-client_1.2.82.428.g0ac8be2b_amd64.deb"
}
},
"1.2.79.427": {
"fullversion": "1.2.79.427.g80eb4a07",
"size": "155456648",
"data": "12.01.2026",
"links": {
"amd64": "https://github.com/LoaderSpot/deb-builds/releases/download/builds/spotify-client_1.2.79.427.g80eb4a07_amd64.deb"
}
},
"1.2.79.425": {
"fullversion": "1.2.79.425.g1d0fcf61",
"size": "155381166",
"data": "17.12.2025",
"links": {
"amd64": "https://github.com/LoaderSpot/deb-builds/releases/download/builds/spotify-client_1.2.79.425.g1d0fcf61_amd64.deb"
}
},
"1.2.77.358": {
"fullversion": "1.2.77.358.g4339a634",
"size": "155510286",
"data": "25.11.2025",
"links": {
"amd64": "https://github.com/LoaderSpot/deb-builds/releases/download/builds/spotify-client_1.2.77.358.g4339a634_amd64.deb"
}
},
"1.2.74.477": {
"fullversion": "1.2.74.477.g3be53afe",
"size": "154653044",