mirror of
https://github.com/Xevion/spotify-quickauth.git
synced 2025-12-06 15:16:37 -06:00
Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 70fd9da886 | |||
| 50de07ef28 | |||
| f8da0a647b | |||
| acf81f6bf6 | |||
| 2866c2fe4a | |||
| 98fc3c9902 | |||
| c52edc3640 | |||
| 3921dbda29 | |||
| 469c27aca0 | |||
| 6cea7fce2f | |||
| 115166c438 | |||
| 86820fba36 | |||
| 7e89218e31 | |||
| 398004daca | |||
| 87b36ec3f2 | |||
| fea498eb18 | |||
| 6a144177ac | |||
| 2d81bdcea5 | |||
| 3389a7f370 | |||
| 8fa4d010a3 | |||
| 500bf75f8f | |||
| d533a4318e | |||
| 6599f58933 | |||
| ca97ae2e15 | |||
| 18b010762e | |||
| 1e484dc3b9 | |||
| 04908d6682 | |||
| c5ebbb6d26 | |||
| c04dd7f6d9 | |||
| b63e033234 | |||
| c8ba73a3f2 | |||
| 15fca3adf0 | |||
| c284ca3c3a | |||
| f7a7a8185f | |||
| c544fe4802 | |||
| 6e7c6bbb66 |
63
.github/workflows/build.yaml
vendored
63
.github/workflows/build.yaml
vendored
@@ -109,17 +109,30 @@ jobs:
|
|||||||
cargo test ${{ github.event.inputs.verbose == 'true' && '--verbose' || '' }} --release --target ${{ matrix.target }}
|
cargo test ${{ github.event.inputs.verbose == 'true' && '--verbose' || '' }} --release --target ${{ matrix.target }}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Export Release Version
|
- name: Prepare Variables
|
||||||
run: echo "RELEASE_VERSION=$(grep '^version = ' Cargo.toml | sed 's/version = \"\(.*\)\"/\1/')" >> $GITHUB_ENV
|
shell: bash
|
||||||
shell: sh
|
run: |
|
||||||
|
RELEASE_VERSION=$(grep '^version = ' Cargo.toml | sed 's/version = \"\(.*\)\"/\1/')
|
||||||
|
ARCHIVE=spotify-quickauth-v$RELEASE_VERSION-${{ matrix.target }}
|
||||||
|
if ${{ contains(matrix.os, 'windows') }}; then
|
||||||
|
ARCHIVE=$ARCHIVE.zip
|
||||||
|
else
|
||||||
|
ARCHIVE=$ARCHIVE.tar.gz
|
||||||
|
fi
|
||||||
|
ARCHIVE_DIR=target/${{ matrix.target }}/release
|
||||||
|
|
||||||
|
# Export variables
|
||||||
|
echo "ARCHIVE_DIR=$ARCHIVE_DIR" >> $GITHUB_ENV
|
||||||
|
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
|
||||||
|
echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Archive
|
- name: Archive
|
||||||
if: ${{ !contains(matrix.os, 'windows') }}
|
if: ${{ !contains(matrix.os, 'windows') }}
|
||||||
uses: TheDoctor0/zip-release@0.7.6
|
uses: TheDoctor0/zip-release@0.7.6
|
||||||
with:
|
with:
|
||||||
type: tar
|
type: tar
|
||||||
filename: spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz
|
filename: ${{ env.ARCHIVE }}
|
||||||
directory: target/${{ matrix.target }}/release/
|
directory: ${{ env.ARCHIVE_DIR }}/
|
||||||
path: |
|
path: |
|
||||||
spotify-quickauth
|
spotify-quickauth
|
||||||
|
|
||||||
@@ -128,11 +141,32 @@ jobs:
|
|||||||
uses: TheDoctor0/zip-release@0.7.6
|
uses: TheDoctor0/zip-release@0.7.6
|
||||||
with:
|
with:
|
||||||
type: zip
|
type: zip
|
||||||
filename: spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.zip
|
filename: ${{ env.ARCHIVE }}
|
||||||
directory: target/${{ matrix.target }}/release/
|
directory: ${{ env.ARCHIVE_DIR }}/
|
||||||
path: |
|
path: |
|
||||||
spotify-quickauth.exe
|
spotify-quickauth.exe
|
||||||
|
|
||||||
|
- name: Install rsign2
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: taiki-e/install-action@v2
|
||||||
|
with:
|
||||||
|
tool: rsign2
|
||||||
|
|
||||||
|
- name: Sign Archive
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
env:
|
||||||
|
MINISIGN_KEY: ${{ secrets.MINISIGN_KEY }}
|
||||||
|
ARCHIVE_PATH: ${{ env.ARCHIVE_DIR }}/${{ env.ARCHIVE }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "$MINISIGN_KEY" > minisign.key
|
||||||
|
|
||||||
|
ts=$(node -e 'console.log((new Date).toISOString())')
|
||||||
|
git=$(git rev-parse HEAD)
|
||||||
|
comment="gh=$GITHUB_REPOSITORY git=$git ts=$ts run=$GITHUB_RUN_ID"
|
||||||
|
|
||||||
|
rsign sign -W -s minisign.key -x "${{ env.ARCHIVE_PATH }}.sig" -t "$comment" "${{ env.ARCHIVE_PATH }}"
|
||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@@ -140,19 +174,20 @@ jobs:
|
|||||||
name: spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}
|
name: spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
path: target/${{ matrix.target }}/release/spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.*
|
path: ${{ env.ARCHIVE_DIR }}/${{ env.ARCHIVE }}
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
target/${{ matrix.target }}/release/spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.*
|
${{ env.ARCHIVE_DIR }}/${{ env.ARCHIVE }}
|
||||||
|
${{ env.ARCHIVE_DIR }}/${{ env.ARCHIVE }}.sig
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
|
|
||||||
# Publish flow
|
- if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.target == 'x86_64-unknown-linux-musl' }}
|
||||||
# - name: cargo login
|
run: cargo login ${{ secrets.CRATES_IO_API_TOKEN }}
|
||||||
# run: cargo login ${{ secrets.CRATES_IO_API_TOKEN }}
|
|
||||||
|
|
||||||
# - name: "cargo release publish"
|
- name: "Publish"
|
||||||
# run: cargo release publish --workspace --all-features --allow-branch HEAD --no-confirm --no-verify --execute
|
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.target == 'x86_64-unknown-linux-musl' }}
|
||||||
|
run: cargo publish --locked --allow-dirty
|
||||||
8
.github/workflows/integration.yaml
vendored
8
.github/workflows/integration.yaml
vendored
@@ -2,10 +2,10 @@ name: Integration
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
workflow_run:
|
# workflow_run:
|
||||||
workflows: ["Build"]
|
# workflows: ["Build"]
|
||||||
types:
|
# types:
|
||||||
- completed
|
# - completed
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
integration-windows:
|
integration-windows:
|
||||||
|
|||||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1 +1,6 @@
|
|||||||
/target
|
/target
|
||||||
|
*.key
|
||||||
|
*.tar.gz
|
||||||
|
*.zip
|
||||||
|
credentials.json
|
||||||
|
spotify-quickauth
|
||||||
|
|||||||
10
.hooks/link.sh
Executable file
10
.hooks/link.sh
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
hooks=(
|
||||||
|
"pre-commit"
|
||||||
|
"pre-push"
|
||||||
|
)
|
||||||
|
|
||||||
|
for hook in "${hooks[@]}"; do
|
||||||
|
chmod +x .hooks/$hook.sh
|
||||||
|
ln -s -f ../../.hooks/$hook.sh .git/hooks/$hook
|
||||||
|
done
|
||||||
7
.hooks/pre-commit.sh
Executable file
7
.hooks/pre-commit.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Remove all lines starting with >[! from CARGO_README.md
|
||||||
|
sed -i '/^>\[!/d' CARGO_README.md
|
||||||
|
|
||||||
|
# Add the modified file to the commit
|
||||||
|
git add CARGO_README.md
|
||||||
96
.hooks/pre-push.sh
Executable file
96
.hooks/pre-push.sh
Executable file
@@ -0,0 +1,96 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Script to be run as part of the github pre-push hook.
|
||||||
|
#
|
||||||
|
# Checks that, if there is a "version-like" tag being pushed, all the files which are supposed to contain the tag do
|
||||||
|
# actually have the correct tag value in them. If they do not, the push is blocked.
|
||||||
|
# NB: this does _not_ automatically alter the source files and commit them with the correct tag value, nor prevent the
|
||||||
|
# tag to be added to the wrong git commit locally (ie. a commit in which the source files have the wrong tag value).
|
||||||
|
# All it does is prevent the developer from pushing the 'bad tags' to remote repositories, giving him/her the chance to
|
||||||
|
# manually rectify the situation on the local repo before retrying to push.
|
||||||
|
#
|
||||||
|
# @todo could this be run as pre-commit hook instead? We have to test if adding a tag does trigger pre-commit hook...
|
||||||
|
# @see https://stackoverflow.com/questions/56538621/git-hook-to-check-tag-name
|
||||||
|
# @see https://stackoverflow.com/questions/8418071/is-there-a-way-to-check-that-a-git-tag-matches-the-content-of-the-corresponding
|
||||||
|
# for an alternative take (enforcing this with a server-side hook)
|
||||||
|
#
|
||||||
|
# NB: remember that this can be run within a windows env too, via fe. the tortoisegit or the git-4-win on the cli!
|
||||||
|
# git for windows comes with its own copy of common unix utils such as bash, grep. But they are sometimes old and/or
|
||||||
|
# buggy compared to what one gets in current linux distros :-(
|
||||||
|
#
|
||||||
|
# This hook is called with the following parameters:
|
||||||
|
#
|
||||||
|
# $1 -- Name of the remote to which the push is being done
|
||||||
|
# $2 -- URL to which the push is being done
|
||||||
|
#
|
||||||
|
# If pushing without using a named remote those arguments will be equal.
|
||||||
|
#
|
||||||
|
# Information about the commits which are being pushed is supplied as lines to
|
||||||
|
# the standard input in the form:
|
||||||
|
#
|
||||||
|
# <local ref> <local oid> <remote ref> <remote oid>
|
||||||
|
|
||||||
|
# We do not abort the push in case there is an error in this script. No `set -e`
|
||||||
|
#set -e
|
||||||
|
|
||||||
|
# @todo detect if this is run outside git hook, and give a warning plus explain how to pass in $local_ref $local_oid $remote_ref $remote_oid
|
||||||
|
# @todo allow a git config parameter to switch on/off a 'verbose mode'
|
||||||
|
# @todo we could allow the variables `files` and `version_tag_regexp` to be set via git config parameters instead of hardcoded
|
||||||
|
|
||||||
|
# List of files which do contain the version tag
|
||||||
|
files='Cargo.toml'
|
||||||
|
|
||||||
|
# Regexp use to decide if a git tag is a version label
|
||||||
|
version_tag_regexp='^[0-9]{1,4}\.[0-9]{1,4}(\.[0-9]{1,4})?'
|
||||||
|
|
||||||
|
# Create a string of '0' chars of appropriate length for the current git version
|
||||||
|
zero="$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')"
|
||||||
|
|
||||||
|
echo "Checking commits for version tags before push..."
|
||||||
|
|
||||||
|
# check all commits which we are pushing
|
||||||
|
while read local_ref local_oid remote_ref remote_oid; do
|
||||||
|
#echo "Checking commit $local_oid ..."
|
||||||
|
# skip ref deletions
|
||||||
|
if [ "$local_oid" != "$zero" ]; then
|
||||||
|
#if [ "$remote_oid" = "$zero" ]; then
|
||||||
|
# # 'new branch'
|
||||||
|
# range="$local_oid"
|
||||||
|
#else
|
||||||
|
# # 'update to existing branch'
|
||||||
|
# range="$remote_oid..$local_oid"
|
||||||
|
#fi
|
||||||
|
# @todo in case we have a range (see commented out code 2 lines above), should we check more commits?
|
||||||
|
tags="$(git tag --points-at $local_oid)"
|
||||||
|
if [ -n "$tags" ]; then
|
||||||
|
# @todo this will not work predictably if there are 2 version tags attached to the same commit. Which probably
|
||||||
|
# there should not be anyway. Should we check for that too and abort in case?
|
||||||
|
while IFS= read -r tag; do
|
||||||
|
echo "Found tag: '$tag'..."
|
||||||
|
if [[ "$tag" =~ $version_tag_regexp ]]; then
|
||||||
|
echo "Tag looks like a version number. Checking if code is matching..."
|
||||||
|
for file in $files; do
|
||||||
|
if [ ! -f "$file" ]; then
|
||||||
|
echo "File is missing: '$file'. Please fix config of github hook script"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
echo "Looking for '$tag' in '$file'"
|
||||||
|
# @todo atm if the version tag is f.e. v1.1, any file containing the string "clamav1.10' will
|
||||||
|
# match. We should improve this match to avoid such scenarios
|
||||||
|
# Note: we can not use `-i` as it crashes git-4-win's grep
|
||||||
|
if grep -F -q "$tag" "$file"; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo "Tag is missing from file '$file'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "All files ok!"
|
||||||
|
break 2; # exit from both while loops: no need to check for further tags
|
||||||
|
fi
|
||||||
|
done <<< "$tags"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 0
|
||||||
94
CARGO_README.md
Normal file
94
CARGO_README.md
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
# spotify-quickauth
|
||||||
|
|
||||||
|
[](https://github.com/Xevion/spotify-quickauth/actions)
|
||||||
|
[](https://crates.io/crates/spotify-quickauth)
|
||||||
|
|
||||||
|
|
||||||
|
A simple CLI-based application for creating a `credentials.json` file, used by `librespot` derived applications, such as [spotify-player][spotify-player], [spotifyd][spotifyd], and [raspotify][raspotify].
|
||||||
|
|
||||||
|
- One command, no compilation, all platforms (Windows, Linux, MacOS), ARM included
|
||||||
|
- Automatically places configuration files
|
||||||
|
- No dependencies, no installation, no fuss
|
||||||
|
|
||||||
|
>This README is literally filled with lies. I'm not joking, I've just typed up a bunch of features I plan to implement, and am planning them out now. A fair amount of it works, but most of the specific options aren't currently implemented. I'm working on it, I promise!
|
||||||
|
|
||||||
|
## Quickstart
|
||||||
|
|
||||||
|
You can run this application without installing anything by using the following commands.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -sSL https://xevion.github.io/spotify-quickauth/run.sh | sh -s --
|
||||||
|
```
|
||||||
|
|
||||||
|
The default invocation is likely fine for most users, it will try to understand the available paths for `credentials.json` to be written to, and allow you to select them.
|
||||||
|
|
||||||
|
> Automatic detection is dependent on the related software being installed and/or relevant configuration files being present.
|
||||||
|
|
||||||
|
For **Windows**, you can paste this command into PowerShell:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
iex (irm "https://xevion.github.io/spotify-quickauth/run.ps1")
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
This application is dead simple to use. Just run the command, and it'll tell you to connect to a fake 'device' in your Spotify interface.
|
||||||
|
|
||||||
|
> You must be connected to the same network running `spotify-quickauth`, as the `zeroconf` technology **does not work** across **networks** nor **proxies**.
|
||||||
|
|
||||||
|
Once you connect, the credentials file will be created, and you'll be prompted to select which location(s) to place it in. Even if none of the relevant `librespot` applications are detected or installed, you can specify manual locations, or the current working directory.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Installation is not necessary to use this application, but if you're having trouble, want to compile it yourself, or are using it frequently, you might want to install it.
|
||||||
|
|
||||||
|
>The scripts above can be given the `-K` or `--keep` flag to keep the downloaded binary. This will prevent repeated API calls to GitHub if you're using the script frequently within a short period.
|
||||||
|
|
||||||
|
|
||||||
|
### Pre-built Binaries
|
||||||
|
|
||||||
|
Binaries are always available for download from the [releases page][releases], and they're the same ones used by the shell scripts above.
|
||||||
|
|
||||||
|
Currently, the following targets are available for download:
|
||||||
|
- x64 Linux (MUSL) `x86_64-unknown-linux-musl`
|
||||||
|
- ARM64 Linux (MUSL) `aarch64-unknown-linux-musl`
|
||||||
|
- ARMv7 Linux `armv7-unknown-linux-musleabihf`
|
||||||
|
- Intel MacOS `x86_64-apple-darwin`
|
||||||
|
- Apple Silicon MacOS `aarch64-apple-darwin`
|
||||||
|
- x64 Windows `x86_64-pc-windows-msvc`
|
||||||
|
- ARM64 Windows `aarch64-pc-windows-msvc`
|
||||||
|
|
||||||
|
If you'd like to use the shell script above to install the binary, you can use the `-S/--stop` flag to prevent the script from running the binary after downloading it. It implicitly applies the `--keep` flag too.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -sSL https://xevion.github.io/spotify-quickauth/run.sh | sh -s -- -S
|
||||||
|
mv spotify-quickauth /usr/local/bin
|
||||||
|
```
|
||||||
|
|
||||||
|
Then you can move it to whatever location you'd like. Make sure that directory is in your $PATH though!
|
||||||
|
|
||||||
|
### Building from Source
|
||||||
|
|
||||||
|
Don't want to run my funky shell script? No problem! You can build the application from source easily.
|
||||||
|
|
||||||
|
- You'll need `cargo`, the Rust build system and package manager. It's included with the Rust toolchain, which you can install from [rustup.rs][rustup]
|
||||||
|
- This is an early project, so the minimum supported version of Rust is not known. I'm developing on 1.81.0 though.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/Xevion/spotify-quickauth.git
|
||||||
|
cd spotify-quickauth
|
||||||
|
cargo install --path .
|
||||||
|
spotify-quickauth --help
|
||||||
|
```
|
||||||
|
|
||||||
|
If you have any troubles building the project
|
||||||
|
- Make sure you're using a target that's supported by the project (see above).
|
||||||
|
- Certain targets may require specfic linkers. For example,
|
||||||
|
|
||||||
|
[spotify-player]: https://github.com/aome510/spotify-player
|
||||||
|
[spotifyd]: https://github.com/Spotifyd/spotifyd
|
||||||
|
[raspotify]: https://github.com/dtcooper/raspotify
|
||||||
|
[rustup]: https://rustup.rs
|
||||||
|
[git]: https://git-scm.com
|
||||||
|
[binstall]: https://github.com/cargo-bins/cargo-binstall
|
||||||
|
[quickinstall]: https://github.com/cargo-bins/cargo-quickinstall
|
||||||
1843
Cargo.lock
generated
1843
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
27
Cargo.toml
27
Cargo.toml
@@ -1,11 +1,32 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "spotify-quickauth"
|
name = "spotify-quickauth"
|
||||||
version = "0.1.1"
|
version = "0.1.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
description = "Quickly authenticate librespot-based applications with Spotify"
|
||||||
|
rust-version = "1.81"
|
||||||
|
authors = ["Ryan Walters <xevion@xevion.dev>"]
|
||||||
|
homepage = "https://github.com/Xevion/spotify-quickauth"
|
||||||
|
repository = "https://github.com/Xevion/spotify-quickauth"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
readme = "CARGO_README.md"
|
||||||
|
|
||||||
|
[package.metadata.binstall]
|
||||||
|
pkg-url = "{ repo }/releases/download/v{ version }/spotify-quickauth-v{ version }-{ target }{ archive-suffix }"
|
||||||
|
pkg-format = "tgz"
|
||||||
|
|
||||||
|
[package.metadata.binstall.signing]
|
||||||
|
algorithm = "minisign"
|
||||||
|
pubkey = "RWSPQt0a5mbpICWV2Ft8iKOPv1F5xvknUeoZo38sKGUxOKbJmHUZE6UC"
|
||||||
|
|
||||||
|
[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
|
||||||
|
pkg-fmt = "zip"
|
||||||
|
|
||||||
|
[package.metadata.binstall.overrides.aarch64-pc-windows-msvc]
|
||||||
|
pkg-fmt = "zip"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
librespot-discovery = { git = "https://github.com/librespot-org/librespot", branch = "dev" }
|
librespot-discovery = { version = "0.4.2" }
|
||||||
librespot-core = { git = "https://github.com/librespot-org/librespot", branch = "dev" }
|
librespot-core = { version = "0.4.2" }
|
||||||
serde = { version = "1.0.210", features = ["derive"] }
|
serde = { version = "1.0.210", features = ["derive"] }
|
||||||
tokio = { version = "1.40.0", features = ["full"] }
|
tokio = { version = "1.40.0", features = ["full"] }
|
||||||
futures = "0.3.30"
|
futures = "0.3.30"
|
||||||
|
|||||||
176
LICENSE-APACHE
Normal file
176
LICENSE-APACHE
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
23
LICENSE-MIT
Normal file
23
LICENSE-MIT
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
Permission is hereby granted, free of charge, to any
|
||||||
|
person obtaining a copy of this software and associated
|
||||||
|
documentation files (the "Software"), to deal in the
|
||||||
|
Software without restriction, including without
|
||||||
|
limitation the rights to use, copy, modify, merge,
|
||||||
|
publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software
|
||||||
|
is furnished to do so, subject to the following
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice
|
||||||
|
shall be included in all copies or substantial portions
|
||||||
|
of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||||
|
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||||
|
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||||
|
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||||
|
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
108
README.md
108
README.md
@@ -1,24 +1,101 @@
|
|||||||
# spotify-quickauth
|
# spotify-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.
|
[](https://github.com/Xevion/spotify-quickauth/actions)
|
||||||
|
<!-- TODO: Add testing status badge -->
|
||||||
|
[](https://crates.io/crates/spotify-quickauth)
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
You can install this application, but most people will just need it once. The following commands will run the application without installing it.
|
|
||||||
|
|
||||||
For Linux and macOS, you can paste this command into your terminal:
|
A simple CLI-based application for creating a `credentials.json` file, used by `librespot` derived applications, such as [spotify-player][spotify-player], [spotifyd][spotifyd], and [raspotify][raspotify].
|
||||||
|
|
||||||
|
- One command, no compilation, all platforms (Windows, Linux, MacOS), ARM included
|
||||||
|
- Automatically places configuration files
|
||||||
|
- No dependencies, no installation, no fuss
|
||||||
|
|
||||||
|
>[!WARNING]
|
||||||
|
>This README is literally filled with lies. I'm not joking, I've just typed up a bunch of features I plan to implement, and am planning them out now. A fair amount of it works, but most of the specific options aren't currently implemented. I'm working on it, I promise!
|
||||||
|
|
||||||
|
## Quickstart
|
||||||
|
|
||||||
|
You can run this application without installing anything by using the following commands.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -sSL https://xevion.github.io/spotify-quickauth/run.sh | sh
|
curl -sSL https://xevion.github.io/spotify-quickauth/run.sh | sh -s --
|
||||||
```
|
```
|
||||||
|
|
||||||
For Windows, you can paste this command into PowerShell:
|
The default invocation is likely fine for most users, it will try to understand the available paths for `credentials.json` to be written to, and allow you to select them.
|
||||||
|
|
||||||
|
>[!NOTE]
|
||||||
|
> Automatic detection is dependent on the related software being installed and/or relevant configuration files being present.
|
||||||
|
|
||||||
|
For **Windows**, you can paste this command into PowerShell:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
iex (irm "https://xevion.github.io/spotify-quickauth/run.ps1")
|
iex (irm "https://xevion.github.io/spotify-quickauth/run.ps1")
|
||||||
```
|
```
|
||||||
|
|
||||||
## Building from Source
|
## Usage
|
||||||
|
|
||||||
|
This application is dead simple to use. Just run the command, and it'll tell you to connect to a fake 'device' in your Spotify interface.
|
||||||
|
|
||||||
|
>[!NOTE]
|
||||||
|
> You must be connected to the same network running `spotify-quickauth`, as the `zeroconf` technology **does not work** across **networks** nor **proxies**.
|
||||||
|
|
||||||
|
Once you connect, the credentials file will be created, and you'll be prompted to select which location(s) to place it in. Even if none of the relevant `librespot` applications are detected or installed, you can specify manual locations, or the current working directory.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Installation is not necessary to use this application, but if you're having trouble, want to compile it yourself, or are using it frequently, you might want to install it.
|
||||||
|
|
||||||
|
>[!NOTE]
|
||||||
|
>The scripts above can be given the `-K` or `--keep` flag to keep the downloaded binary. This will prevent repeated API calls to GitHub if you're using the script frequently within a short period.
|
||||||
|
|
||||||
|
|
||||||
|
### Pre-built Binaries
|
||||||
|
|
||||||
|
Binaries are always available for download from the [releases page][latestRelease], and they're the same ones used by the shell scripts above.
|
||||||
|
|
||||||
|
Currently, the following targets are available for download:
|
||||||
|
- x64 Linux (MUSL) `x86_64-unknown-linux-musl`
|
||||||
|
- ARM64 Linux (MUSL) `aarch64-unknown-linux-musl`
|
||||||
|
- ARMv7 Linux `armv7-unknown-linux-musleabihf`
|
||||||
|
- Intel MacOS `x86_64-apple-darwin`
|
||||||
|
- Apple Silicon MacOS `aarch64-apple-darwin`
|
||||||
|
- x64 Windows `x86_64-pc-windows-msvc`
|
||||||
|
- ARM64 Windows `aarch64-pc-windows-msvc`
|
||||||
|
|
||||||
|
Please [file an issue][new-issue] if you are on a platform that is not supported, or if you encounter issues with the binaries.
|
||||||
|
|
||||||
|
### Via `cargo-binstall`
|
||||||
|
|
||||||
|
>[!NOTE]
|
||||||
|
> If the package cannot be found for your target or fails to be downloaded for any reason, `cargo-binstall` will automatically fall back to building the package from source.
|
||||||
|
|
||||||
|
`cargo-binstall` is a tool that allows you to install binaries from crates.io without needing to compile them yourself.
|
||||||
|
|
||||||
|
```
|
||||||
|
cargo binstall spotify-quickauth
|
||||||
|
```
|
||||||
|
|
||||||
|
If you're curious where the binary comes from, `cargo-binstall` will likely pull the binary directly from the [latest release][latestRelease] by this repository, selecting the most appropriate target for your host.
|
||||||
|
|
||||||
|
|
||||||
|
### Manual Installation
|
||||||
|
|
||||||
|
If you'd like to use the shell script above to install the binary, you can use the `-S/--stop` flag to prevent the script from running the binary after downloading it. It implicitly applies the `--keep` flag too.
|
||||||
|
|
||||||
|
You'll need to move the binary yourself though:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -sSL https://xevion.github.io/spotify-quickauth/run.sh | sh -s -- -S
|
||||||
|
mv spotify-quickauth /usr/local/bin
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure your directory of choice is in your $PATH though!
|
||||||
|
|
||||||
|
### Building from Source
|
||||||
|
|
||||||
Don't want to run my funky shell script? No problem! You can build the application from source easily.
|
Don't want to run my funky shell script? No problem! You can build the application from source easily.
|
||||||
|
|
||||||
@@ -28,10 +105,21 @@ Don't want to run my funky shell script? No problem! You can build the applicati
|
|||||||
```bash
|
```bash
|
||||||
git clone https://github.com/Xevion/spotify-quickauth.git
|
git clone https://github.com/Xevion/spotify-quickauth.git
|
||||||
cd spotify-quickauth
|
cd spotify-quickauth
|
||||||
cargo build --release
|
cargo install --path .
|
||||||
./target/release/spotify-quickauth
|
spotify-quickauth --help
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you have any troubles building the project
|
||||||
|
- Make sure you're using a target that's supported by the project (see above).
|
||||||
|
- Certain targets may require specfic linkers. For example,
|
||||||
|
|
||||||
|
[latestRelease]: https://github.com/Xevion/spotify-quickauth/releases/latest/
|
||||||
[spotify-player]: https://github.com/aome510/spotify-player
|
[spotify-player]: https://github.com/aome510/spotify-player
|
||||||
|
[spotifyd]: https://github.com/Spotifyd/spotifyd
|
||||||
|
[raspotify]: https://github.com/dtcooper/raspotify
|
||||||
[rustup]: https://rustup.rs
|
[rustup]: https://rustup.rs
|
||||||
[git]: https://git-scm.com
|
[git]: https://git-scm.com
|
||||||
|
[binstall]: https://github.com/cargo-bins/cargo-binstall
|
||||||
|
[quickinstall]: https://github.com/cargo-bins/cargo-quickinstall
|
||||||
|
[binstall-installation]: https://github.com/cargo-bins/cargo-binstall#installation
|
||||||
|
[new-issue]: https://github.com/Xevion/spotify-quickauth/issues/new
|
||||||
28
run.sh
28
run.sh
@@ -1,5 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ "$OS" = "Windows_NT" ]; then
|
if [ "$OS" = "Windows_NT" ]; then
|
||||||
@@ -14,6 +13,23 @@ else
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Flags parsing
|
||||||
|
STOP=0
|
||||||
|
KEEP=0
|
||||||
|
for arg in "$@"; do
|
||||||
|
case $arg in
|
||||||
|
-K|--keep)
|
||||||
|
# Keep the unzipped executable after running
|
||||||
|
KEEP=1
|
||||||
|
;;
|
||||||
|
-S|--stop)
|
||||||
|
# Don't run the executable after unzipping (also keeps it)
|
||||||
|
STOP=1
|
||||||
|
KEEP=1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# Fetch the latest release download URL
|
# Fetch the latest release download URL
|
||||||
REPO="Xevion/spotify-quickauth"
|
REPO="Xevion/spotify-quickauth"
|
||||||
API_URL="https://api.github.com/repos/$REPO/releases/latest"
|
API_URL="https://api.github.com/repos/$REPO/releases/latest"
|
||||||
@@ -29,8 +45,12 @@ fi
|
|||||||
|
|
||||||
EXECUTABLE="spotify-quickauth"
|
EXECUTABLE="spotify-quickauth"
|
||||||
curl -Lso $EXECUTABLE.tar.gz $DOWNLOAD_URL
|
curl -Lso $EXECUTABLE.tar.gz $DOWNLOAD_URL
|
||||||
tar -xvf $EXECUTABLE.tar.gz $EXECUTABLE
|
tar -xvf $EXECUTABLE.tar.gz $EXECUTABLE 1>/dev/null
|
||||||
rm $EXECUTABLE.tar.gz
|
rm $EXECUTABLE.tar.gz
|
||||||
chmod +x $EXECUTABLE
|
chmod +x $EXECUTABLE
|
||||||
trap "rm -f $EXECUTABLE" INT EXIT
|
if [ "$KEEP" -eq 0 ]; then
|
||||||
./$EXECUTABLE
|
trap "rm -f $EXECUTABLE" INT EXIT
|
||||||
|
fi
|
||||||
|
if [ "$STOP" -eq 0 ]; then
|
||||||
|
./$EXECUTABLE $@
|
||||||
|
fi
|
||||||
@@ -5,7 +5,6 @@ use librespot_core::config::DeviceType;
|
|||||||
use librespot_discovery::Discovery;
|
use librespot_discovery::Discovery;
|
||||||
use log::{info, warn};
|
use log::{info, warn};
|
||||||
use sha1::{Digest, Sha1};
|
use sha1::{Digest, Sha1};
|
||||||
use librespot_core::SessionConfig;
|
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
||||||
#[tokio::main(flavor = "current_thread")]
|
#[tokio::main(flavor = "current_thread")]
|
||||||
@@ -42,7 +41,7 @@ async fn main() {
|
|||||||
let device_id = hex::encode(Sha1::digest(device_name.as_bytes()));
|
let device_id = hex::encode(Sha1::digest(device_name.as_bytes()));
|
||||||
let device_type = DeviceType::Computer;
|
let device_type = DeviceType::Computer;
|
||||||
|
|
||||||
let mut server = Discovery::builder(device_id, SessionConfig::default().client_id)
|
let mut server = Discovery::builder(device_id)
|
||||||
.name(device_name.clone())
|
.name(device_name.clone())
|
||||||
.device_type(device_type)
|
.device_type(device_type)
|
||||||
.launch()
|
.launch()
|
||||||
@@ -52,7 +51,7 @@ async fn main() {
|
|||||||
|
|
||||||
let mut written = false;
|
let mut written = false;
|
||||||
while let Some(credentials) = server.next().await {
|
while let Some(credentials) = server.next().await {
|
||||||
let result = File::create(&credentials_file).and_then(|mut file| {
|
let result = File::create("./credentials.json").and_then(|mut file| {
|
||||||
let data = serde_json::to_string(&credentials)?;
|
let data = serde_json::to_string(&credentials)?;
|
||||||
write!(file, "{data}")
|
write!(file, "{data}")
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user