File tree 5 files changed +18
-13
lines changed
5 files changed +18
-13
lines changed Original file line number Diff line number Diff line change 26
26
runs-on : ubuntu-latest
27
27
28
28
environment :
29
- name : about-me
30
- url : https://dvcol.github.io/about-me /
29
+ name : trakt-extension
30
+ url : https://dvcol.github.io/trakt-extension /
31
31
32
32
steps :
33
33
- name : Checkout branch ${{ github.ref }}
Original file line number Diff line number Diff line change @@ -17,12 +17,8 @@ const router = useRouter();
17
17
const { isAuthenticated } = useAuthSettingsStoreRefs ();
18
18
19
19
onMounted (() => {
20
- console .info (' authResponse:' , route .query );
21
20
const { redirect } = route .query ;
22
- if (redirect ) {
23
- console .info (' redirect:' , redirect , isAuthenticated .value );
24
- router .push (route .query .redirect as string );
25
- }
21
+ if (redirect ) router .push (route .query .redirect as string );
26
22
});
27
23
28
24
const redirect = async () => {
Original file line number Diff line number Diff line change @@ -82,7 +82,9 @@ export class TraktService {
82
82
}
83
83
84
84
static async approve ( params : TraktAuthenticationApprove = { } ) {
85
- const url = this . traktClient . redirectToAuthenticationUrl ( params ) ;
85
+ const url = this . traktClient
86
+ . redirectToAuthenticationUrl ( params )
87
+ . replace ( `${ traktClientSettings . corsProxy } /${ traktClientSettings . corsPrefix } ` , traktClientSettings . endpoint ) ;
86
88
return createTab ( { url } ) ;
87
89
}
88
90
Original file line number Diff line number Diff line change 1
1
import type { TraktClientSettings } from '~/models/trakt/trakt-client.model' ;
2
2
3
+ import { WebConfig } from '~/settings/web.config' ;
3
4
import { chromeRuntimeId } from '~/utils/browser/browser.utils' ;
4
5
5
6
export const Config = {
@@ -24,13 +25,19 @@ const isProd = import.meta.env.PROD;
24
25
25
26
const client = isProd ? Production : Staging ;
26
27
27
- const browserRedirect = window . location . href . split ( '#' ) . at ( 0 ) ?? client . RedirectionUrl ;
28
-
29
- export const traktClientSettings : TraktClientSettings = {
28
+ const traktClientSettings : TraktClientSettings = {
30
29
client_id : client . ID ,
31
30
client_secret : client . Secret ,
32
- redirect_uri : chromeRuntimeId ? client . RedirectionUrl : browserRedirect ,
31
+ redirect_uri : client . RedirectionUrl ,
33
32
endpoint : client . TraktEndpoint ,
34
33
35
34
useragent : Config . UserAgent ,
36
35
} ;
36
+
37
+ if ( ! chromeRuntimeId ) {
38
+ traktClientSettings . redirect_uri = window . location . origin + ( import . meta. env . VITE_BASE ? `/${ import . meta. env . VITE_BASE } ` : '' ) ;
39
+ traktClientSettings . corsProxy = WebConfig . CorsProxy ;
40
+ traktClientSettings . corsPrefix = WebConfig . CorsPrefix . trakt ;
41
+ }
42
+
43
+ export { traktClientSettings } ;
Original file line number Diff line number Diff line change 1
- global . chrome = { } as typeof chrome ;
1
+ global . chrome = { runtime : { id : 'extension-id' } } as typeof chrome ;
You can’t perform that action at this time.
0 commit comments