sloss-cli 1.3.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build.sh +15 -4
  2. package/package.json +1 -1
package/build.sh CHANGED
@@ -208,13 +208,24 @@ echo ""
208
208
  echo "📤 Uploading to Sloss..."
209
209
 
210
210
  # Resolve Sloss URL and API key
211
- UPLOAD_URL="${SLOSS_URL:-https://sloss.ngrok.app}/upload"
211
+ CREDS_FILE="$HOME/.config/sloss/credentials.json"
212
+
213
+ # Resolve Sloss URL: env var > credentials.json > default
214
+ if [[ -n "${SLOSS_URL:-}" ]]; then
215
+ UPLOAD_URL="${SLOSS_URL}/upload"
216
+ elif [[ -f "$CREDS_FILE" ]]; then
217
+ CREDS_URL=$(node -e "try{console.log(JSON.parse(require('fs').readFileSync('$CREDS_FILE','utf8')).url||'')}catch{console.log('')}")
218
+ UPLOAD_URL="${CREDS_URL:-https://sloss.ngrok.app}/upload"
219
+ else
220
+ UPLOAD_URL="https://sloss.ngrok.app/upload"
221
+ fi
212
222
 
223
+ # Resolve API key: env var > credentials.json > error
213
224
  if [[ -z "${SLOSS_API_KEY:-}" ]]; then
214
- CREDS_FILE="$HOME/.config/sloss/credentials.json"
215
225
  if [[ -f "$CREDS_FILE" ]]; then
216
- SLOSS_API_KEY=$(node -e "console.log(JSON.parse(require('fs').readFileSync('$CREDS_FILE','utf8')).api_key)")
217
- else
226
+ SLOSS_API_KEY=$(node -e "try{console.log(JSON.parse(require('fs').readFileSync('$CREDS_FILE','utf8')).apiKey||'')}catch{console.log('')}")
227
+ fi
228
+ if [[ -z "${SLOSS_API_KEY:-}" ]]; then
218
229
  echo "❌ No SLOSS_API_KEY env var and no ~/.config/sloss/credentials.json found."
219
230
  echo " Artifact is at: $ARTIFACT_PATH"
220
231
  exit 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sloss-cli",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "CLI for Sloss — a self-hosted IPA/APK distribution server",
5
5
  "type": "module",
6
6
  "bin": {