mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00
27 lines
957 B
Dart
27 lines
957 B
Dart
import 'dart:convert';
|
|
import 'dart:io';
|
|
|
|
import 'package:path/path.dart' as path;
|
|
|
|
void main(List<String> args) async {
|
|
if (args.isEmpty) {
|
|
throw ArgumentError(
|
|
"Expected 2 arguments but passed ${args.length < 2 || args.length > 2 ? args.length : "none"}");
|
|
}
|
|
|
|
final decodedSecret = utf8.decode(base64Decode(args.first));
|
|
final decodedSpotifySecrete = utf8.decode(base64Decode(args.last));
|
|
final val = jsonDecode(decodedSecret);
|
|
final val2 = jsonDecode(decodedSpotifySecrete);
|
|
if (val is! List || (val2 is! List && (val2 as List).first is! Map)) {
|
|
throw Exception(
|
|
"'LYRICS_SECRET' and 'SPOTIFY_SECRET' Environmental Variable isn't configured properly");
|
|
}
|
|
|
|
await File(path.join(
|
|
Directory.current.path, "lib/models/generated_secrets.dart"))
|
|
.writeAsString(
|
|
"final List<String> lyricsSecrets = $decodedSecret;\nfinal List<Map<String, dynamic>> spotifySecrets = $decodedSpotifySecrete;",
|
|
);
|
|
}
|