prrimary profile id will be used for mobile sync

This commit is contained in:
tapframe 2026-03-02 23:05:11 +05:30
parent b996396f17
commit 0899aa8a49

View file

@ -404,23 +404,23 @@ class SupabaseSyncService {
watchedRows,
deviceRows,
] = await Promise.all([
this.request<Array<{ id: string }>>(`/rest/v1/plugins?select=id&user_id=eq.${ownerFilter}`, {
this.request<Array<{ id: string }>>(`/rest/v1/plugins?select=id&user_id=eq.${ownerFilter}&profile_id=eq.1`, {
method: 'GET',
authToken: token,
}),
this.request<Array<{ id: string }>>(`/rest/v1/addons?select=id&user_id=eq.${ownerFilter}`, {
this.request<Array<{ id: string }>>(`/rest/v1/addons?select=id&user_id=eq.${ownerFilter}&profile_id=eq.1`, {
method: 'GET',
authToken: token,
}),
this.request<Array<{ id: string }>>(`/rest/v1/watch_progress?select=id&user_id=eq.${ownerFilter}`, {
this.request<Array<{ id: string }>>(`/rest/v1/watch_progress?select=id&user_id=eq.${ownerFilter}&profile_id=eq.1`, {
method: 'GET',
authToken: token,
}),
this.request<Array<{ id: string }>>(`/rest/v1/library_items?select=id&user_id=eq.${ownerFilter}`, {
this.request<Array<{ id: string }>>(`/rest/v1/library_items?select=id&user_id=eq.${ownerFilter}&profile_id=eq.1`, {
method: 'GET',
authToken: token,
}),
this.request<Array<{ id: string }>>(`/rest/v1/watched_items?select=id&user_id=eq.${ownerFilter}`, {
this.request<Array<{ id: string }>>(`/rest/v1/watched_items?select=id&user_id=eq.${ownerFilter}&profile_id=eq.1`, {
method: 'GET',
authToken: token,
}),
@ -935,7 +935,7 @@ class SupabaseSyncService {
private normalizeUrl(url: string): string {
let u = url.trim().toLowerCase();
u = u.replace(/\/manifest\.json\/?$/i, '');
u = u.replace(/\/+$/, '');
return u;
@ -1092,7 +1092,7 @@ class SupabaseSyncService {
if (!ownerId) return;
const rows = await this.request<PluginRow[]>(
`/rest/v1/plugins?select=url,name,enabled,sort_order&user_id=eq.${encodeURIComponent(ownerId)}&order=sort_order.asc`,
`/rest/v1/plugins?select=url,name,enabled,sort_order&user_id=eq.${encodeURIComponent(ownerId)}&profile_id=eq.1&order=sort_order.asc`,
{
method: 'GET',
authToken: token,
@ -1174,7 +1174,7 @@ class SupabaseSyncService {
if (!ownerId) return;
const rows = await this.request<AddonRow[]>(
`/rest/v1/addons?select=url,sort_order&user_id=eq.${encodeURIComponent(ownerId)}&order=sort_order.asc`,
`/rest/v1/addons?select=url,sort_order&user_id=eq.${encodeURIComponent(ownerId)}&profile_id=eq.1&order=sort_order.asc`,
{
method: 'GET',
authToken: token,
@ -1371,15 +1371,15 @@ class SupabaseSyncService {
key,
signature,
row: {
content_id: parsed.contentId,
content_type: parsed.contentType,
video_id: parsed.videoId,
season: parsed.season,
episode: parsed.episode,
position: this.secondsToMsLong(value.currentTime),
duration: this.secondsToMsLong(value.duration),
last_watched: this.normalizeEpochMs(value.lastUpdated || Date.now()),
progress_key: parsed.progressKey,
content_id: parsed.contentId,
content_type: parsed.contentType,
video_id: parsed.videoId,
season: parsed.season,
episode: parsed.episode,
position: this.secondsToMsLong(value.currentTime),
duration: this.secondsToMsLong(value.duration),
last_watched: this.normalizeEpochMs(value.lastUpdated || Date.now()),
progress_key: parsed.progressKey,
},
});
}