fix: allowing debrid services to be disabled

This commit is contained in:
Chubby Granny Chaser
2025-03-17 20:24:14 +00:00
parent 6b4d422b65
commit 9976812bf7
13 changed files with 143 additions and 55 deletions

View File

@@ -1,2 +1,4 @@
MAIN_VITE_API_URL=API_URL
MAIN_VITE_AUTH_URL=AUTH_URL
RENDERER_VITE_REAL_DEBRID_REFERRAL_ID=
RENDERER_VITE_TORBOX_REFERRAL_CODE=

View File

@@ -47,12 +47,13 @@ jobs:
MAIN_VITE_API_URL: ${{ vars.MAIN_VITE_STAGING_API_URL }}
MAIN_VITE_AUTH_URL: ${{ vars.MAIN_VITE_STAGING_AUTH_URL }}
MAIN_VITE_CHECKOUT_URL: ${{ vars.MAIN_VITE_STAGING_CHECKOUT_URL }}
RENDERER_VITE_INTERCOM_APP_ID: ${{ vars.RENDERER_VITE_INTERCOM_APP_ID }}
RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }}
MAIN_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
RENDERER_VITE_SENTRY_DSN: ${{ vars.SENTRY_DSN }}
RENDERER_VITE_REAL_DEBRID_REFERRAL_ID: ${{ vars.RENDERER_VITE_REAL_DEBRID_REFERRAL_ID }}
RENDERER_VITE_TORBOX_REFERRAL_CODE: ${{ vars.RENDERER_VITE_TORBOX_REFERRAL_CODE }}
- name: Build Windows
if: matrix.os == 'windows-latest'
@@ -61,14 +62,15 @@ jobs:
MAIN_VITE_API_URL: ${{ vars.MAIN_VITE_STAGING_API_URL }}
MAIN_VITE_AUTH_URL: ${{ vars.MAIN_VITE_STAGING_AUTH_URL }}
MAIN_VITE_CHECKOUT_URL: ${{ vars.MAIN_VITE_STAGING_CHECKOUT_URL }}
RENDERER_VITE_INTERCOM_APP_ID: ${{ vars.RENDERER_VITE_INTERCOM_APP_ID }}
RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }}
MAIN_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
RENDERER_VITE_SENTRY_DSN: ${{ vars.SENTRY_DSN }}
RENDERER_VITE_REAL_DEBRID_REFERRAL_ID: ${{ vars.RENDERER_VITE_REAL_DEBRID_REFERRAL_ID }}
RENDERER_VITE_TORBOX_REFERRAL_CODE: ${{ vars.RENDERER_VITE_TORBOX_REFERRAL_CODE }}
- name: Test Upload build
- name: Upload build
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}

View File

@@ -49,13 +49,13 @@ jobs:
MAIN_VITE_API_URL: ${{ vars.MAIN_VITE_API_URL }}
MAIN_VITE_AUTH_URL: ${{ vars.MAIN_VITE_AUTH_URL }}
MAIN_VITE_CHECKOUT_URL: ${{ vars.MAIN_VITE_CHECKOUT_URL }}
MAIN_VITE_ANALYTICS_API_URL: ${{ vars.MAIN_VITE_ANALYTICS_API_URL }}
RENDERER_VITE_INTERCOM_APP_ID: ${{ vars.RENDERER_VITE_INTERCOM_APP_ID }}
RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }}
MAIN_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
RENDERER_VITE_SENTRY_DSN: ${{ vars.SENTRY_DSN }}
RENDERER_VITE_REAL_DEBRID_REFERRAL_ID: ${{ vars.RENDERER_VITE_REAL_DEBRID_REFERRAL_ID }}
RENDERER_VITE_TORBOX_REFERRAL_CODE: ${{ vars.RENDERER_VITE_TORBOX_REFERRAL_CODE }}
- name: Build Windows
if: matrix.os == 'windows-latest'
@@ -64,13 +64,13 @@ jobs:
MAIN_VITE_API_URL: ${{ vars.MAIN_VITE_API_URL }}
MAIN_VITE_AUTH_URL: ${{ vars.MAIN_VITE_AUTH_URL }}
MAIN_VITE_CHECKOUT_URL: ${{ vars.MAIN_VITE_CHECKOUT_URL }}
MAIN_VITE_ANALYTICS_API_URL: ${{ vars.MAIN_VITE_ANALYTICS_API_URL }}
RENDERER_VITE_INTERCOM_APP_ID: ${{ vars.RENDERER_VITE_INTERCOM_APP_ID }}
RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }}
MAIN_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
RENDERER_VITE_SENTRY_DSN: ${{ vars.SENTRY_DSN }}
RENDERER_VITE_REAL_DEBRID_REFERRAL_ID: ${{ vars.RENDERER_VITE_REAL_DEBRID_REFERRAL_ID }}
RENDERER_VITE_TORBOX_REFERRAL_CODE: ${{ vars.RENDERER_VITE_TORBOX_REFERRAL_CODE }}
- name: Create artifact
uses: actions/upload-artifact@v4

View File

@@ -272,7 +272,7 @@
"confirm_button_confirmation_delete_all_sources": "Yes, delete everything",
"title_confirmation_delete_all_sources": "Delete all download sources",
"description_confirmation_delete_all_sources": "You will delete all download sources",
"button_delete_all_sources": "Remove all download sources",
"button_delete_all_sources": "Remove all",
"added_download_source": "Added download source",
"download_sources_synced": "All download sources are synced",
"insert_valid_json_url": "Insert a valid JSON url",
@@ -335,6 +335,8 @@
"enable_torbox": "Enable Torbox",
"torbox_description": "TorBox is your premium seedbox service rivaling even the best servers on the market.",
"torbox_account_linked": "TorBox account linked",
"create_real_debrid_account": "Click here if you don't have a Real-Debrid account yet",
"create_torbox_account": "Click here if you don't have a TorBox account yet",
"real_debrid_account_linked": "Real-Debrid account linked",
"name_min_length": "Theme name must be at least 3 characters long",
"import_theme": "Import theme",

View File

@@ -260,8 +260,8 @@
"cancel_button_confirmation_delete_all_sources": "Não",
"confirm_button_confirmation_delete_all_sources": "Sim, excluir tudo",
"title_confirmation_delete_all_sources": "Remover todas as fontes de download",
"description_confirmation_delete_all_sources": "Você irá remover todas as fontes de download",
"button_delete_all_sources": "Remover todas as fontes de download",
"description_confirmation_delete_all_sources": "Você irá remover todas as fontes de download. Deseja prosseguir?",
"button_delete_all_sources": "Remover todas",
"added_download_source": "Fonte adicionada",
"download_sources_synced": "As fontes foram sincronizadas",
"insert_valid_json_url": "Insira a url de um JSON válido",
@@ -322,6 +322,8 @@
"enable_torbox": "Habilitar Torbox",
"torbox_description": "TorBox é o seu serviço de seedbox premium que rivaliza até com os melhores servidores do mercado.",
"torbox_account_linked": "Conta do TorBox vinculada",
"create_real_debrid_account": "Clique aqui se você ainda não tem uma conta do Real-Debrid",
"create_torbox_account": "Clique aqui se você ainda não tem uma conta do TorBox",
"real_debrid_account_linked": "Conta Real-Debrid associada",
"name_min_length": "O nome do tema deve ter pelo menos 3 caracteres",
"import_theme": "Importar tema",

View File

@@ -260,7 +260,7 @@
"description_confirmation_delete_all_sources": "Irá remover todas as fontes de download",
"title_confirmation_delete_all_sources": "Remover todas as fontes de download",
"removed_download_sources": "Fontes de download removidas",
"button_delete_all_sources": "Remover todas as fontes de download",
"button_delete_all_sources": "Remover todas",
"added_download_source": "Fonte adicionada",
"download_sources_synced": "As fontes foram sincronizadas",
"insert_valid_json_url": "Insere o URL de um JSON válido",

View File

@@ -54,8 +54,8 @@
}
}
&__remove_all_sources_button {
&__buttons-container {
display: flex;
justify-content: flex-end;
gap: globals.$spacing-unit;
}
}

View File

@@ -13,7 +13,7 @@ import {
NoEntryIcon,
PlusCircleIcon,
SyncIcon,
XIcon,
TrashIcon,
} from "@primer/octicons-react";
import { AddDownloadSourceModal } from "./add-download-source-modal";
import { useAppDispatch, useRepacks, useToast } from "@renderer/hooks";
@@ -173,7 +173,8 @@ export function SettingsDownloadSources() {
disabled={
!downloadSources.length ||
isSyncingDownloadSources ||
isRemovingDownloadSource
isRemovingDownloadSource ||
isFetchingSources
}
onClick={syncDownloadSources}
>
@@ -181,30 +182,37 @@ export function SettingsDownloadSources() {
{t("sync_download_sources")}
</Button>
<Button
type="button"
theme="outline"
onClick={() => setShowAddDownloadSourceModal(true)}
disabled={isSyncingDownloadSources}
>
<PlusCircleIcon />
{t("add_download_source")}
</Button>
</div>
{!isFetchingSources && downloadSources.length >= 2 && (
<div className="settings-download-sources__remove_all_sources_button">
<div className="settings-download-sources__buttons-container">
<Button
type="button"
theme="danger"
onClick={() => setShowConfirmationDeleteAllSourcesModal(true)}
disabled={isRemovingDownloadSource}
disabled={
isRemovingDownloadSource ||
isSyncingDownloadSources ||
!downloadSources.length ||
isFetchingSources
}
>
<XIcon />
<TrashIcon />
{t("button_delete_all_sources")}
</Button>
<Button
type="button"
theme="outline"
onClick={() => setShowAddDownloadSourceModal(true)}
disabled={
isSyncingDownloadSources ||
isFetchingSources ||
isRemovingDownloadSource
}
>
<PlusCircleIcon />
{t("add_download_source")}
</Button>
</div>
)}
</div>
<ul className="settings-download-sources__list">
{downloadSources.map((downloadSource) => (

View File

@@ -7,12 +7,22 @@
gap: globals.$spacing-unit;
}
&__description {
margin-bottom: calc(globals.$spacing-unit * 2);
}
&__submit-button {
align-self: flex-end;
width: 100%;
}
&__description-container {
display: flex;
flex-direction: column;
gap: globals.$spacing-unit;
margin-bottom: calc(globals.$spacing-unit * 2);
align-items: flex-start;
}
&__create-account {
display: flex;
align-items: center;
gap: globals.$spacing-unit;
}
}

View File

@@ -7,7 +7,14 @@ import "./settings-real-debrid.scss";
import { useAppSelector, useToast } from "@renderer/hooks";
import { settingsContext } from "@renderer/context";
import { LinkExternalIcon } from "@primer/octicons-react";
const realDebridReferralId = import.meta.env
.RENDERER_VITE_REAL_DEBRID_REFERRAL_ID;
const REAL_DEBRID_URL = realDebridReferralId
? `https://real-debrid.com/?id=${realDebridReferralId}`
: "https://real-debrid.com";
const REAL_DEBRID_API_TOKEN_URL = "https://real-debrid.com/apitoken";
export function SettingsRealDebrid() {
@@ -74,24 +81,43 @@ export function SettingsRealDebrid() {
}
};
const toggleRealDebrid = () => {
const updatedValue = !form.useRealDebrid;
setForm((prev) => ({
...prev,
useRealDebrid: updatedValue,
}));
if (!updatedValue) {
updateUserPreferences({
realDebridApiToken: null,
});
}
};
const isButtonDisabled =
(form.useRealDebrid && !form.realDebridApiToken) || isLoading;
return (
<form className="settings-real-debrid__form" onSubmit={handleFormSubmit}>
<p className="settings-real-debrid__description">
{t("real_debrid_description")}
</p>
<div className="settings-real-debrid__description-container">
<p className="settings-real-debrid__description">
{t("real_debrid_description")}
</p>
<Link
to={REAL_DEBRID_URL}
className="settings-real-debrid__create-account"
>
<LinkExternalIcon />
{t("create_real_debrid_account")}
</Link>
</div>
<CheckboxField
label={t("enable_real_debrid")}
checked={form.useRealDebrid}
onChange={() => {
setForm((prev) => ({
...prev,
useRealDebrid: !form.useRealDebrid,
}));
}}
onChange={toggleRealDebrid}
/>
{form.useRealDebrid && (

View File

@@ -7,12 +7,22 @@
gap: globals.$spacing-unit;
}
&__description {
margin-bottom: calc(globals.$spacing-unit * 2);
}
&__submit-button {
align-self: flex-end;
width: 100%;
}
&__description-container {
display: flex;
flex-direction: column;
gap: globals.$spacing-unit;
margin-bottom: calc(globals.$spacing-unit * 2);
align-items: flex-start;
}
&__create-account {
display: flex;
align-items: center;
gap: globals.$spacing-unit;
}
}

View File

@@ -7,7 +7,13 @@ import "./settings-torbox.scss";
import { useAppSelector, useToast } from "@renderer/hooks";
import { settingsContext } from "@renderer/context";
import { LinkExternalIcon } from "@primer/octicons-react";
const torBoxReferralCode = import.meta.env.RENDERER_VITE_TORBOX_REFERRAL_CODE;
const TORBOX_URL = torBoxReferralCode
? `https://torbox.app/subscription?referral=${torBoxReferralCode}`
: "https://torbox.app";
const TORBOX_API_TOKEN_URL = "https://torbox.app/settings";
export function SettingsTorbox() {
@@ -69,19 +75,37 @@ export function SettingsTorbox() {
const isButtonDisabled =
(form.useTorBox && !form.torBoxApiToken) || isLoading;
const toggleTorBox = () => {
const updatedValue = !form.useTorBox;
setForm((prev) => ({
...prev,
useTorBox: updatedValue,
}));
if (!updatedValue) {
updateUserPreferences({
torBoxApiToken: null,
});
}
};
return (
<form className="settings-torbox__form" onSubmit={handleFormSubmit}>
<p className="settings-torbox__description">{t("torbox_description")}</p>
<div className="settings-torbox__description-container">
<p className="settings-torbox__description">
{t("torbox_description")}
</p>
<Link to={TORBOX_URL} className="settings-torbox__create-account">
<LinkExternalIcon />
{t("create_torbox_account")}
</Link>
</div>
<CheckboxField
label={t("enable_torbox")}
checked={form.useTorBox}
onChange={() =>
setForm((prev) => ({
...prev,
useTorBox: !form.useTorBox,
}))
}
onChange={toggleTorBox}
/>
{form.useTorBox && (

View File

@@ -4,6 +4,8 @@
interface ImportMetaEnv {
readonly RENDERER_VITE_EXTERNAL_RESOURCES_URL: string;
readonly RENDERER_VITE_SENTRY_DSN: string;
readonly RENDERER_VITE_REAL_DEBRID_REFERRAL_ID: string;
readonly RENDERER_VITE_TORBOX_REFERRAL_CODE: string;
}
interface ImportMeta {