From f2679c48136fd7c6c901a27b6ce974e16fd56bc3 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Wed, 3 Jan 2024 20:45:28 +0000 Subject: [PATCH] Allow loading large amount of unauth subscriptions through POST method. --- src/components/FeedPage.vue | 15 ++++++++++++--- src/components/SubscriptionsPage.vue | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/components/FeedPage.vue b/src/components/FeedPage.vue index 1dfd5302..cb8e11de 100644 --- a/src/components/FeedPage.vue +++ b/src/components/FeedPage.vue @@ -124,9 +124,18 @@ export default { authToken: this.getAuthToken(), }); } else { - return await this.fetchJson(this.authApiUrl() + "/feed/unauthenticated", { - channels: this.getUnauthenticatedChannels(), - }); + const channels = this.getUnauthenticatedChannels(); + const split = channels.split(","); + if (split.length > 100) { + return await this.fetchJson(this.authApiUrl() + "/feed/unauthenticated", null, { + method: "POST", + body: JSON.stringify(split), + }); + } else { + return await this.fetchJson(this.authApiUrl() + "/feed/unauthenticated", { + channels: channels, + }); + } } }, async loadChannelGroups() { diff --git a/src/components/SubscriptionsPage.vue b/src/components/SubscriptionsPage.vue index 116e4572..85b49050 100644 --- a/src/components/SubscriptionsPage.vue +++ b/src/components/SubscriptionsPage.vue @@ -167,9 +167,18 @@ export default { }, }); } else { - return await this.fetchJson(this.authApiUrl() + "/subscriptions/unauthenticated", { - channels: this.getUnauthenticatedChannels(), - }); + const channels = this.getUnauthenticatedChannels(); + const split = channels.split(","); + if (split.length > 100) { + return await this.fetchJson(this.authApiUrl() + "/subscriptions/unauthenticated", null, { + method: "POST", + body: JSON.stringify(split), + }); + } else { + return await this.fetchJson(this.authApiUrl() + "/subscriptions/unauthenticated", { + channels: this.getUnauthenticatedChannels(), + }); + } } }, async loadChannelGroups() {