Skip to content

Commit

Permalink
fix: console error
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyantong2000 committed Mar 5, 2025
1 parent 8010a2f commit 5139743
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/helpers/get-gitee-developer-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export function getDeveloperNameByUrl() {

export async function isDeveloperWithMeta() {
const platform = getPlatform();
if (platform === 'unknown') {
return false;
}
return pageDetect.isUserProfile() && (await metaStore.has(platform, getDeveloperName()));
}

Expand Down
3 changes: 3 additions & 0 deletions src/helpers/get-gitee-repo-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@ export async function isPublicRepo() {
}
export async function isPublicRepoWithMeta() {
const platform = getPlatform();
if (platform === 'unknown') {
return false;
}
return (await isPublicRepo()) && (await metaStore.has(platform, getRepoNameByUrl()));
}
3 changes: 3 additions & 0 deletions src/helpers/get-github-developer-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export function getDeveloperNameByUrl() {
}
export async function isDeveloperWithMeta() {
const platform = getPlatform();
if (platform === 'unknown') {
return false;
}
return pageDetect.isUserProfile() && (await metaStore.has(platform, getDeveloperName()));
}
export async function isUserProfile() {
Expand Down
3 changes: 3 additions & 0 deletions src/helpers/get-github-repo-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export async function isPublicRepo() {
}
export async function isPublicRepoWithMeta() {
const platform = getPlatform();
if (platform === 'unknown') {
return false;
}
return (
(await isPublicRepo()) &&
((await metaStore.has(platform, getRepoNameByUrl())) || (await metaStore.has(platform, getRepoNameByPage())))
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/get-platform.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import isGitee from './is-gitee';
import isGithub from './is-github';

export const getPlatform = (): 'github' | 'gitee' => {
export const getPlatform = (): 'github' | 'gitee' | 'unknown' => {
if (isGithub()) return 'github';
if (isGitee()) return 'gitee';
throw new Error('Unsupported platform');
return 'unknown';
};

0 comments on commit 5139743

Please sign in to comment.