-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: configure pocketbase, generate dart types, update playback to u…
…se server instead of hive cache This commit currently turns off sponsor block segment for compatibility reasons
- Loading branch information
Showing
19 changed files
with
369 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,3 +75,5 @@ appimage-build | |
|
||
android/key.properties | ||
.fvm/flutter_sdk | ||
|
||
**/pb_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'package:flutter_dotenv/flutter_dotenv.dart'; | ||
|
||
abstract class Env { | ||
static final String pocketbaseUrl = dotenv.get('POCKETBASE_URL'); | ||
static final String username = dotenv.get('USERNAME'); | ||
static final String password = dotenv.get('PASSWORD'); | ||
|
||
static configure() async { | ||
await dotenv.load(fileName: ".env"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import 'package:json_annotation/json_annotation.dart'; | ||
import 'package:pocketbase/pocketbase.dart'; | ||
part 'track.g.dart'; | ||
|
||
@JsonSerializable() | ||
class BackendTrack extends RecordModel { | ||
@JsonKey(name: "spotify_id") | ||
final String spotifyId; | ||
@JsonKey(name: "youtube_id") | ||
final String youtubeId; | ||
final int votes; | ||
|
||
BackendTrack({ | ||
required this.spotifyId, | ||
required this.youtubeId, | ||
required this.votes, | ||
}); | ||
|
||
factory BackendTrack.fromRecord(RecordModel record) => | ||
BackendTrack.fromJson(record.toJson()); | ||
|
||
factory BackendTrack.fromJson(Map<String, dynamic> json) => | ||
_$BackendTrackFromJson(json); | ||
|
||
@override | ||
Map<String, dynamic> toJson() => _$BackendTrackToJson(this); | ||
|
||
static String collection = "tracks"; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import 'package:catcher/catcher.dart'; | ||
import 'package:pocketbase/pocketbase.dart'; | ||
import 'package:spotube/collections/env.dart'; | ||
|
||
final pb = PocketBase(Env.pocketbaseUrl); | ||
bool isLoggedIn = false; | ||
Future<void> initializePocketBase() async { | ||
try { | ||
await pb.collection("users").authWithPassword(Env.username, Env.password); | ||
isLoggedIn = true; | ||
} catch (e, stack) { | ||
Catcher.reportCheckedError(e, stack); | ||
} | ||
} |
Oops, something went wrong.