Remove share token consent

This commit is contained in:
Pas 2025-04-03 22:49:55 -06:00
parent 0471c14f7c
commit 53962312d7
3 changed files with 0 additions and 85 deletions

View file

@ -49,8 +49,6 @@ export function FEDAPISetup() {
const [isExpanded, setIsExpanded] = useState(false);
const febboxToken = useAuthStore((s) => s.febboxToken);
const setFebboxToken = useAuthStore((s) => s.setFebboxToken);
const febboxTokenShared = useAuthStore((s) => s.febboxTokenShared);
const setFebboxTokenShared = useAuthStore((s) => s.setFebboxTokenShared);
const [status, setStatus] = useState<Status>("unset");
const statusMap: Record<Status, StatusCircleProps["type"]> = {
@ -169,27 +167,6 @@ export function FEDAPISetup() {
API is down
</p>
)}
<div className="mt-6 flex items-center">
<input
type="checkbox"
id="share-token-consent"
checked={febboxTokenShared}
onChange={(e) => setFebboxTokenShared(e.target.checked)}
className="mr-3 mt-0.5 w-4 h-4 accent-buttons-secondary"
/>
<label
htmlFor="share-token-consent"
className="text-type-seccondary cursor-pointer"
>
Support FED API by contributing your token?
</label>
</div>
<p className="text-type-secondary text-xs mt-2">
If you chose to contribute your token, it allows anyone to use
FED API (Shared) without bringing their own token! You token is
kept private and encrypted.
</p>
</>
) : null}
</SettingsCard>

View file

@ -229,8 +229,6 @@ async function getFebboxTokenStatus(febboxToken: string | null) {
function FebboxTokenEdit({ febboxToken, setFebboxToken }: FebboxTokenProps) {
const { t } = useTranslation();
const [showVideo, setShowVideo] = useState(false);
const febboxTokenShared = useAuthStore((s) => s.febboxTokenShared);
const setFebboxTokenShared = useAuthStore((s) => s.setFebboxTokenShared);
const [status, setStatus] = useState<Status>("unset");
const statusMap: Record<Status, StatusCircleProps["type"]> = {
@ -345,27 +343,6 @@ function FebboxTokenEdit({ febboxToken, setFebboxToken }: FebboxTokenProps) {
API is down
</p>
)}
<div className="mt-6 flex items-center">
<input
type="checkbox"
id="share-token-consent"
checked={febboxTokenShared}
onChange={(e) => setFebboxTokenShared(e.target.checked)}
className="mr-3 mt-0.5 w-4 h-4 accent-buttons-secondary"
/>
<label
htmlFor="share-token-consent"
className="text-type-seccondary cursor-pointer"
>
Support FED API by contributing your token?
</label>
</div>
<p className="text-type-secondary text-xs mt-2">
If you chose to contribute your token, it allows anyone to use FED
API (Shared) without bringing their own token! You token is kept
private and encrypted.
</p>
</>
) : null}
</SettingsCard>

View file

@ -23,7 +23,6 @@ interface AuthStore {
backendUrl: null | string;
proxySet: null | string[];
febboxToken: null | string;
febboxTokenShared: boolean;
removeAccount(): void;
setAccount(acc: AccountWithToken): void;
updateDeviceName(deviceName: string): void;
@ -32,7 +31,6 @@ interface AuthStore {
setBackendUrl(url: null | string): void;
setProxySet(urls: null | string[]): void;
setFebboxToken(token: null | string): void;
setFebboxTokenShared(shared: boolean): void;
}
export const useAuthStore = create(
@ -42,7 +40,6 @@ export const useAuthStore = create(
backendUrl: null,
proxySet: null,
febboxToken: null,
febboxTokenShared: false,
setAccount(acc) {
set((s) => {
s.account = acc;
@ -77,16 +74,6 @@ export const useAuthStore = create(
console.warn("Failed to access localStorage:", e);
}
},
setFebboxTokenShared(shared) {
set((s) => {
s.febboxTokenShared = shared;
});
try {
localStorage.setItem("share-token", shared ? "true" : "false");
} catch (e) {
console.warn("Failed to access localStorage:", e);
}
},
setAccountProfile(profile) {
set((s) => {
if (s.account) {
@ -122,19 +109,6 @@ export const useAuthStore = create(
console.warn("LocalStorage access failed during migration:", e);
}
}
if (persistedState.febboxTokenShared === undefined) {
try {
const shareToken = localStorage.getItem("share-token");
if (shareToken) {
persistedState.febboxTokenShared = shareToken === "true";
} else {
persistedState.febboxTokenShared = false;
}
} catch (e) {
console.warn("LocalStorage access failed during migration:", e);
persistedState.febboxTokenShared = false;
}
}
return persistedState;
},
onRehydrateStorage: () => (state) => {
@ -146,19 +120,6 @@ export const useAuthStore = create(
console.warn("Failed to sync token to localStorage:", e);
}
}
if (state) {
try {
localStorage.setItem(
"share-token",
state.febboxTokenShared ? "true" : "false",
);
} catch (e) {
console.warn(
"Failed to sync token sharing preference to localStorage:",
e,
);
}
}
},
},
),