Bookmarks (#153)
* Empty bookmarks screen * Bookmarks object * Long press support * Lint fix * Context menu v1 * A working context menu * Basic bookmarks in context menu * Use a root content node for bookmarks * context menu animation * small tweak * move logger around, adjust animation * Lint fix * Restore logger fix * Cache channel info * Bookmarks v1 * Added comment * Adjust "popular" feed error handling * Progress with bookmarks * Add todo * add todo * handle roDateTime logging * logger adjustment * Use yaml for api and layout * rename requestData to feedSource * Restructure things * Lint fix * remove comment * introduce feedSource id * small cleanup * playlist context menu * Context menu for the channel view * changelog --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
This commit is contained in:
1 parent
620a8a6e2b
commit
c740d5e0a0
63 files changed
+1889
-510
No files matched your search
@@ -30,12 +30,15 @@ export class InvidiousApi {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
public async makeRequest(requestData: any) {
|
||||
if (!requestData || !this.instance || !this.endpoints) {
|
||||
public async makeRequest(feed: any) {
|
||||
// TODO:P0 handle multiple feed sources
|
||||
const feedSource = feed.feedSources[0]
|
||||
|
||||
if (!feedSource || !this.instance || !this.endpoints) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let endpoint = this.endpoints[requestData.endpoint];
|
||||
let endpoint = this.endpoints[feedSource.endpoint];
|
||||
if (!endpoint) {
|
||||
return null;
|
||||
}
|
||||
@@ -49,7 +52,7 @@ export class InvidiousApi {
|
||||
if (!this.isLoggedIn) {
|
||||
return null;
|
||||
}
|
||||
return await PlayletApi.invidiousAuthenticatedRequest(requestData);
|
||||
return await PlayletApi.invidiousAuthenticatedRequest(feedSource);
|
||||
}
|
||||
|
||||
if (endpoint.queryParams !== undefined) {
|
||||
@@ -69,13 +72,13 @@ export class InvidiousApi {
|
||||
}
|
||||
}
|
||||
|
||||
if (requestData.queryParams !== undefined) {
|
||||
queryParams = { ...queryParams, ...requestData.queryParams };
|
||||
if (feedSource.queryParams !== undefined) {
|
||||
queryParams = { ...queryParams, ...feedSource.queryParams };
|
||||
}
|
||||
|
||||
if (requestData.pathParams !== undefined) {
|
||||
for (let param in requestData.pathParams) {
|
||||
url = url.replace(`{${param}}`, requestData.pathParams[param]);
|
||||
if (feedSource.pathParams !== undefined) {
|
||||
for (let param in feedSource.pathParams) {
|
||||
url = url.replace(`{${param}}`, feedSource.pathParams[param]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,10 +89,10 @@ export class InvidiousApi {
|
||||
if (!responseHandler) {
|
||||
return null;
|
||||
}
|
||||
return await responseHandler(requestData, response);
|
||||
return await responseHandler(feedSource, response);
|
||||
}
|
||||
|
||||
private async DefaultHandler(requestData, response) {
|
||||
private async DefaultHandler(feedSource, response) {
|
||||
const items = await response.json();
|
||||
return { items };
|
||||
}
|
||||
|
||||
@@ -14,12 +14,12 @@ export class PlayletApi {
|
||||
}
|
||||
|
||||
static async getHomeLayoutFile() {
|
||||
const response = await fetch(`${PlayletApi.host()}/config/default_home_layout.json5`);
|
||||
const response = await fetch(`${PlayletApi.host()}/config/default_home_layout.yaml`);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
static async getInvidiousVideoApiFile() {
|
||||
const response = await fetch(`${PlayletApi.host()}/config/invidious_video_api.json5`);
|
||||
const response = await fetch(`${PlayletApi.host()}/config/invidious_video_api.yaml`);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user