Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: console error #972

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
};
Loading