sec: remove auth for other logins
This commit is contained in:
3 files changed
+7
-4
No files matched your search
@@ -1 +0,0 @@
|
|||||||
A lot of the code in here was either inspired or modified from https://github.com/aeharding/threadiverse, which is licensed under the AGPL 3.0.
|
|
||||||
@@ -63,8 +63,11 @@ export function client({
|
|||||||
if (!instanceURL)
|
if (!instanceURL)
|
||||||
instanceURL = profile.current.instance || DEFAULT_INSTANCE_URL
|
instanceURL = profile.current.instance || DEFAULT_INSTANCE_URL
|
||||||
|
|
||||||
const jwt = auth ? auth : profile.current?.jwt
|
// we use nullish coealsiaihsa something so that
|
||||||
|
// we can set auth = '' to remove it
|
||||||
|
const jwt = auth ?? profile.current?.jwt
|
||||||
|
|
||||||
|
// but not here, so that if jwt == '', it doesnt put a bearer
|
||||||
const headers = jwt ? { authorization: `Bearer ${jwt}` } : {}
|
const headers = jwt ? { authorization: `Bearer ${jwt}` } : {}
|
||||||
|
|
||||||
return new LemmyHttp(instanceToURL(instanceURL), {
|
return new LemmyHttp(instanceToURL(instanceURL), {
|
||||||
@@ -74,6 +77,7 @@ export function client({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// here for parts where i forgor to switch
|
||||||
export function getClient(
|
export function getClient(
|
||||||
instanceURL?: string,
|
instanceURL?: string,
|
||||||
func?: (
|
func?: (
|
||||||
@@ -89,7 +93,7 @@ export async function validateInstance(instance: string): Promise<boolean> {
|
|||||||
if (instance == '') return false
|
if (instance == '') return false
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await getClient(instance).getSite()
|
await client({ instanceURL: instance, auth: '' }).getSite()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
--font-display: Inter, system-ui, sans-serif;
|
--font-display: Inter, system-ui, sans-serif;
|
||||||
--font-mono: monospace;
|
--font-mono: monospace;
|
||||||
|
|
||||||
--animate-pop-in: pop-in 0.8s cubic-bezier(0.075, 0.82, 0.165, 1);
|
--animate-pop-in: pop-in 0.8s cubic-bezier(0.075, 0.82, 0.165, 1) forwards;
|
||||||
|
|
||||||
--ease-cubic: cubic-bezier(0.075, 0.82, 0.165, 1);
|
--ease-cubic: cubic-bezier(0.075, 0.82, 0.165, 1);
|
||||||
--spacing-22: 88px;
|
--spacing-22: 88px;
|
||||||
|
|||||||
Reference in new issue
Block a user