diff --git a/.gitignore b/.gitignore index 8005e0c2..55ed55ea 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,5 @@ yarn-error.log* node_modules +# chrome extension zip files +baekjoon-hub.zip diff --git a/.yarn/cache/@esbuild-win32-arm64-npm-0.21.5-d0ef444aab-8.zip b/.yarn/cache/@esbuild-win32-arm64-npm-0.21.5-d0ef444aab-8.zip new file mode 100644 index 00000000..d624773b Binary files /dev/null and b/.yarn/cache/@esbuild-win32-arm64-npm-0.21.5-d0ef444aab-8.zip differ diff --git a/.yarn/cache/@esbuild-win32-ia32-npm-0.21.5-a4fb03dad4-8.zip b/.yarn/cache/@esbuild-win32-ia32-npm-0.21.5-a4fb03dad4-8.zip new file mode 100644 index 00000000..4a52574d Binary files /dev/null and b/.yarn/cache/@esbuild-win32-ia32-npm-0.21.5-a4fb03dad4-8.zip differ diff --git a/.yarn/cache/@esbuild-win32-x64-npm-0.21.5-eddc2b5ad6-8.zip b/.yarn/cache/@esbuild-win32-x64-npm-0.21.5-eddc2b5ad6-8.zip new file mode 100644 index 00000000..cbd0d73e Binary files /dev/null and b/.yarn/cache/@esbuild-win32-x64-npm-0.21.5-eddc2b5ad6-8.zip differ diff --git a/.yarn/cache/@rollup-rollup-win32-arm64-msvc-npm-4.18.1-bc8bdea5a8-8.zip b/.yarn/cache/@rollup-rollup-win32-arm64-msvc-npm-4.18.1-bc8bdea5a8-8.zip new file mode 100644 index 00000000..1da39c21 Binary files /dev/null and b/.yarn/cache/@rollup-rollup-win32-arm64-msvc-npm-4.18.1-bc8bdea5a8-8.zip differ diff --git a/.yarn/cache/@rollup-rollup-win32-ia32-msvc-npm-4.18.1-d0a091e910-8.zip b/.yarn/cache/@rollup-rollup-win32-ia32-msvc-npm-4.18.1-d0a091e910-8.zip new file mode 100644 index 00000000..0d4211ae Binary files /dev/null and b/.yarn/cache/@rollup-rollup-win32-ia32-msvc-npm-4.18.1-d0a091e910-8.zip differ diff --git a/.yarn/cache/@rollup-rollup-win32-x64-msvc-npm-4.18.1-4558fd3f13-93107c5c51.zip b/.yarn/cache/@rollup-rollup-win32-x64-msvc-npm-4.18.1-4558fd3f13-8.zip similarity index 100% rename from .yarn/cache/@rollup-rollup-win32-x64-msvc-npm-4.18.1-4558fd3f13-93107c5c51.zip rename to .yarn/cache/@rollup-rollup-win32-x64-msvc-npm-4.18.1-4558fd3f13-8.zip diff --git a/.yarnrc.yml b/.yarnrc.yml index a2d1d72c..616f7370 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -23,5 +23,6 @@ supportedArchitectures: os: - darwin - linux + - win32 yarnPath: .yarn/releases/yarn-3.8.1.cjs diff --git a/apps/baekjoon-hub/manifest.json b/apps/baekjoon-hub/manifest.json index 54a89228..d4804911 100644 --- a/apps/baekjoon-hub/manifest.json +++ b/apps/baekjoon-hub/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "PoolC Baekjoon Hub", - "version": "1.0.3", + "version": "1.0.5", "description": "Yonsei Univ Programming Club PoolC integration with Baekjoon", "action": { "default_icon": "assets/images/logo-poolc.png", diff --git a/apps/baekjoon-hub/scripts/background.js b/apps/baekjoon-hub/scripts/background.js index a5e7188e..9d652234 100644 --- a/apps/baekjoon-hub/scripts/background.js +++ b/apps/baekjoon-hub/scripts/background.js @@ -2,6 +2,10 @@ const POOLC_BASE_URL = 'https://poolc.org/api'; const appFetch = (...args) => fetch(...args).then((res) => { + if (res.status === 401) { + throw new Error('unauthorized'); + } + if (res.status >= 400) { throw new Error('fetch error. please check network tab'); } @@ -29,7 +33,9 @@ function handleMessage(request, _, sendResponse) { 'Content-Type': 'application/json', Authorization: `Bearer ${token}`, }, - }).then(() => sendResponse({ success: true })); + }) + .then(() => sendResponse({ success: true })) + .catch(() => sendResponse({ success: false })); }); } // login check diff --git a/apps/baekjoon-hub/scripts/baekjoon/baekjoon.js b/apps/baekjoon-hub/scripts/baekjoon/baekjoon.js index ab5617a4..ccdf6b61 100644 --- a/apps/baekjoon-hub/scripts/baekjoon/baekjoon.js +++ b/apps/baekjoon-hub/scripts/baekjoon/baekjoon.js @@ -17,7 +17,6 @@ function showToast(message) { document.body.append(box); - console.log('toast!'); setTimeout(() => { box.style.opacity = 0; }, 2000 - 300); @@ -27,6 +26,32 @@ function showToast(message) { }, 2000); } +function showErrorToast(message) { + const toast = `