Skip to content

Commit

Permalink
1時間ごとにサインインが要求される問題の修正
Browse files Browse the repository at this point in the history
  • Loading branch information
yudai1204 committed Jan 8, 2025
1 parent 684e9b1 commit 2ede647
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "scombz-utilities",
"displayName": "ScombZ Utilities",
"version": "4.4.0",
"version": "4.4.1",
"description": "__MSG_extensionDescription__",
"author": "udai",
"scripts": {
Expand Down
16 changes: 10 additions & 6 deletions src/backgrounds/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ export const getClasses = async (sendResponse?: (response: any) => void) => {
try {
console.log("getClasses Start");

// 毎回ログイン画面になるのは嫌なので、ログイン済みかどうかをstorageから取得
// トークンを取得
const token = await new Promise((resolve, reject) => {
chrome.identity.getAuthToken({ interactive: true }, (token) => {
if (chrome.runtime.lastError || !token) {
reject(chrome.runtime.lastError || "トークン取得に失敗しました。");
} else {
resolve(token);
}
chrome.storage.local.get(defaultSaves, (currentData: Saves) => {
const interactive = !currentData.settings.googleClassroom.isSignedIn;
chrome.identity.getAuthToken({ interactive }, (token) => {
if (chrome.runtime.lastError || !token) {
reject(chrome.runtime.lastError || "トークン取得に失敗しました。");
} else {
resolve(token);
}
});
});
});

Expand Down

0 comments on commit 2ede647

Please sign in to comment.