This commit is contained in:
@@ -31,8 +31,9 @@ export default class SugoiAuthProvider implements AuthProvider {
|
||||
#token: Token
|
||||
clientId: string;
|
||||
|
||||
constructor(client_id: string) {
|
||||
constructor(client_id: string, proxy_origin = import.meta.url) {
|
||||
this.clientId = client_id
|
||||
TwitchAuth.setProxyOrigin(proxy_origin)
|
||||
}
|
||||
|
||||
#setToken = (token: Token) => {
|
||||
|
||||
@@ -22,7 +22,15 @@ export interface AuthCode {
|
||||
}
|
||||
|
||||
const redirect_uri = location.origin + location.pathname
|
||||
const proxy_uri = new URL('/oauth2/token', import.meta.url)
|
||||
let proxy_uri = new URL('/oauth2/token', import.meta.url)
|
||||
|
||||
/**
|
||||
* Changes the origin used for proxying oauth requests
|
||||
* Required when using this as an npm module
|
||||
*/
|
||||
export function setProxyOrigin(proxy_origin: string) {
|
||||
proxy_uri = new URL('/oauth2/token', proxy_origin)
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp and return the token
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
export * as SugoiAuth from './SugoiAuthProvider'
|
||||
export * as WebStorage from './WebStorage'
|
||||
@@ -4,6 +4,9 @@
|
||||
"module": "es2020",
|
||||
"moduleResolution": "node",
|
||||
"allowImportingTsExtensions": true,
|
||||
"noEmit": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"declarationDir": "../static"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user