mirror of
https://github.com/Xevion/spotify-quickauth.git
synced 2025-12-10 04:08:47 -06:00
repo init
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/target
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# spotify-player-quickauth
|
||||
|
||||
A simple CLI-based application for creating a `credentials.json` file, used by the [spotify-player][spotify-player] library, for authenticating with the Spotify API.
|
||||
52
run.sh
Executable file
52
run.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Determine the platform
|
||||
OS=$(uname)
|
||||
ARCH=$(uname -m)
|
||||
|
||||
# Set the download URL based on the platform
|
||||
if [[ "$OS" == "Linux" ]]; then
|
||||
if [[ "$ARCH" == "x86_64" ]]; then
|
||||
PLATFORM="linux-amd64"
|
||||
elif [[ "$ARCH" == "aarch64" ]]; then
|
||||
PLATFORM="linux-arm64"
|
||||
else
|
||||
echo "Unsupported architecture: $ARCH"
|
||||
exit 1
|
||||
fi
|
||||
elif [[ "$OS" == "Darwin" ]]; then
|
||||
if [[ "$ARCH" == "x86_64" ]]; then
|
||||
PLATFORM="darwin-amd64"
|
||||
elif [[ "$ARCH" == "arm64" ]]; then
|
||||
PLATFORM="darwin-arm64"
|
||||
else
|
||||
echo "Unsupported architecture: $ARCH"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Unsupported OS: $OS"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Fetch the latest release download URL
|
||||
REPO="Xevion/spotify-player-quickauth"
|
||||
API_URL="https://api.github.com/repos/$REPO/releases/latest"
|
||||
DOWNLOAD_URL=$(curl -s $API_URL | grep "browser_download_url.*$PLATFORM" | cut -d '"' -f 4)
|
||||
|
||||
if [[ -z "$DOWNLOAD_URL" ]]; then
|
||||
echo "Failed to find a download URL for platform: $PLATFORM"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# # Download the executable
|
||||
# EXECUTABLE="spotify-player-quickauth"
|
||||
# curl -L -o $EXECUTABLE $DOWNLOAD_URL
|
||||
|
||||
# # Make the executable runnable
|
||||
# chmod +x $EXECUTABLE
|
||||
|
||||
# # Run the executable
|
||||
# ./$EXECUTABLE
|
||||
|
||||
# # Delete the executable
|
||||
# rm $EXECUTABLE
|
||||
24
src/main.rs
Normal file
24
src/main.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
use std::env;
|
||||
use std::process::Command;
|
||||
use std::io;
|
||||
|
||||
fn main() {
|
||||
let os = env::consts::OS;
|
||||
let arch = env::consts::ARCH;
|
||||
let username = env::var("USER").unwrap_or_else(|_| "unknown".to_string());
|
||||
let hostname = Command::new("hostname")
|
||||
.output()
|
||||
.map(|output| String::from_utf8_lossy(&output.stdout).trim().to_string())
|
||||
.unwrap_or_else(|_| "unknown".to_string());
|
||||
let execution_path = env::current_exe()
|
||||
.map(|path| path.display().to_string())
|
||||
.unwrap_or_else(|_| "unknown".to_string());
|
||||
let working_directory = env::current_dir()
|
||||
.map(|path| path.display().to_string())
|
||||
.unwrap_or_else(|_| "unknown".to_string());
|
||||
|
||||
println!(
|
||||
"{}@{} ({}/{}) [{}] [{}]",
|
||||
username, hostname, os, arch, working_directory, execution_path
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user