Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Shiba 2022-10-06 17:04:49 +00:00
commit a9192480d5
5 changed files with 8 additions and 22 deletions

View file

@ -70,22 +70,18 @@ export function resetProfileSettings() {
async function apiRequest<T extends object>(method: 'GET' | 'POST', pathname: string, data: T) {
const settings = await getExtensionSettingsAsync()
/* const urlResolverSettings = ytUrlResolversSettings[settings.urlResolver]
if (!urlResolverSettings.signRequest) throw new Error() */
const url = new URL(ytUrlResolversSettings.madiatorFinder.href/* urlResolverSettings.href */)
const url = new URL(ytUrlResolversSettings.madiatorFinder.href)
url.pathname = path.join(url.pathname, pathname)
url.searchParams.set('data', JSON.stringify(data))
if (true/* requiresSignature */) {
if (!settings.privateKey || !settings.publicKey)
throw new Error('There is no profile.')
if (!settings.privateKey || !settings.publicKey)
throw new Error('There is no profile.')
url.searchParams.set('keys', JSON.stringify({
signature: await sign(url.searchParams.toString(), settings.privateKey!),
publicKey: settings.publicKey
}))
}
url.searchParams.set('keys', JSON.stringify({
signature: await sign(url.searchParams.toString(), settings.privateKey!),
publicKey: settings.publicKey
}))
const respond = await fetch(url.href, { method })

View file

@ -75,7 +75,6 @@ async function get(id: string): Promise<string | null | undefined> {
await clearExpired()
return undefined
}
console.log('cache found', id, response.value)
return response.value
}

View file

@ -1,6 +1,5 @@
#popup {
width: 40em;
max-width: 100%;
overflow: hidden;
margin: auto;
}
@ -40,12 +39,6 @@ label {
text-align: center;
}
section>b {
display: block;
width: 100%;
text-align: left;
}
section>* {
padding: 0 1rem;
}
@ -65,4 +58,4 @@ section>* {
.toggle-option {
display: grid;
gap: .5em;
}
}

View file

@ -20,7 +20,6 @@ chrome.runtime.onMessage.addListener(({ method, data }, sender, sendResponse) =>
const params: Parameters<typeof resolveById> = JSON.parse(data)
// Don't create a new Promise for same ID until on going one is over.
const promise = onGoingLbryPathnameRequest[data] ?? (onGoingLbryPathnameRequest[data] = resolveById(...params))
console.log('lbrypathname request', params, await promise)
resolve(await promise)
} catch (error) {
sendResponse(`error: ${(error as any).toString()}`)

View file

@ -231,7 +231,6 @@ import { getExtensionSettingsAsync, getSourcePlatfromSettingsFromHostname, getTa
console.error("Background error on:", params)
throw new Error(`Background error. ${response ?? ''}`)
}
console.log(response)
return response ? JSON.parse(response) : null
}