@lvce-editor/auth-worker 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2743,6 +2743,16 @@ const getElectronRedirectUri = async uid => {
2743
2743
  return `http://localhost:${localOauthServerPort}/callback`;
2744
2744
  };
2745
2745
 
2746
+ const getGithubPagesBasePath = url => {
2747
+ if (!url.hostname.endsWith('.github.io')) {
2748
+ return '';
2749
+ }
2750
+ const firstSegment = url.pathname.split('/').find(Boolean);
2751
+ if (!firstSegment) {
2752
+ return '';
2753
+ }
2754
+ return `/${firstSegment}`;
2755
+ };
2746
2756
  const getWebRedirectUri = async () => {
2747
2757
  const href = await getCurrentHref();
2748
2758
  if (!href) {
@@ -2750,7 +2760,7 @@ const getWebRedirectUri = async () => {
2750
2760
  }
2751
2761
  try {
2752
2762
  const url = new URL(href);
2753
- return `${url.origin}/auth/callback`;
2763
+ return `${url.origin}${getGithubPagesBasePath(url)}/auth/callback`;
2754
2764
  } catch {
2755
2765
  return '';
2756
2766
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/auth-worker",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Auth Worker",
5
5
  "repository": {
6
6
  "type": "git",