Skip to content

Commit 15261a4

Browse files
committed
word review
1 parent e3ca071 commit 15261a4

20 files changed

+335
-251
lines changed

.prettierignore

-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ coverage
44
node_modules
55
pnpm-lock.yaml
66
pnpm-workspace.yaml
7-
youglish.js

manifest.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"client_id": "718785835689-d2lqmos8aa7kfgtq6mplp7v2hb83eahh.apps.googleusercontent.com",
4141
"scopes": ["https://www.googleapis.com/auth/drive.file"]
4242
},
43-
"host_permissions": ["*://*.youglish.com/"],
4443
"permissions": [
4544
"tts",
4645
"storage",
@@ -51,7 +50,6 @@
5150
"identity",
5251
"contextMenus",
5352
"sidePanel",
54-
"alarms",
55-
"cookies"
53+
"alarms"
5654
]
5755
}

public/icons/review.png

202 Bytes
Loading

public/youglish-prepare.js

-40
This file was deleted.

public/youglish.html

-43
This file was deleted.

public/youglish.js

-2
This file was deleted.

src/background/index.ts

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Messages, WordMap, WordInfoMap, WordContext, StorageKey, LevelKey } from '../constant'
22
import { explainWord } from '../lib/openai'
3-
import { syncUpKnowns, getLocalValue, getAllKnownSync, addLocalKnownsLogs, removeLocalKnownsLogs } from '../lib/storage'
3+
import { syncUpKnowns, getLocalValue, getAllKnownSync } from '../lib/storage'
44
import { settings } from '../lib/settings'
55
import { triggerGoogleDriveSyncJob, syncWithDrive } from '../lib/backup/sync'
66

@@ -98,9 +98,11 @@ const checkOffscreenDocumentExist = async (offscreenUrl: string) => {
9898
if (chrome.runtime.getContexts) {
9999
// @ts-ignore
100100
const existingContexts = await chrome.runtime.getContexts({
101+
// @ts-ignore
101102
contextTypes: ['OFFSCREEN_DOCUMENT'],
102103
documentUrls: [offscreenUrl]
103104
})
105+
// @ts-ignore
104106
return existingContexts.length > 0
105107
// @ts-ignore
106108
} else if (globalThis.clients) {
@@ -173,7 +175,6 @@ chrome.runtime.onConnect.addListener(async port => {
173175
updateBadge(knowns)
174176
sendMessageToAllTabs({ action, word })
175177
triggerGoogleDriveSyncJob()
176-
addLocalKnownsLogs([word])
177178
break
178179
case Messages.set_all_known:
179180
const addedWords = words.reduce((acc: WordMap, cur: string) => ({ ...acc, [cur]: 'o' }), {})
@@ -182,7 +183,6 @@ chrome.runtime.onConnect.addListener(async port => {
182183
updateBadge(knowns)
183184
sendMessageToAllTabs({ action, words })
184185
triggerGoogleDriveSyncJob()
185-
addLocalKnownsLogs(words)
186186
break
187187
case Messages.add_context: {
188188
const contexts = (await getLocalValue(StorageKey.context)) ?? {}
@@ -219,11 +219,6 @@ chrome.runtime.onConnect.addListener(async port => {
219219
case Messages.play_audio:
220220
playAudio(msg.audio, word)
221221
break
222-
case Messages.open_youglish:
223-
chrome.tabs.create({
224-
url: chrome.runtime.getURL('youglish.html') + `?word=${encodeURIComponent(word)}`
225-
})
226-
break
227222
case Messages.fetch_html: {
228223
const { url, uuid } = msg
229224
const htmlRes = await fetch(url, {
@@ -321,7 +316,6 @@ chrome.contextMenus.onClicked.addListener(async (info, tab) => {
321316
updateBadge(knowns)
322317
sendMessageToAllTabs({ action: Messages.set_unknown, word: originFormWord })
323318
triggerGoogleDriveSyncJob()
324-
removeLocalKnownsLogs(originFormWord)
325319
}
326320
}
327321
})

src/constant.ts

-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export enum Messages {
6262
'delete_context' = 'delete_context',
6363
'app_available' = 'app_available',
6464
'play_audio' = 'play_audio',
65-
'open_youglish' = 'open_youglish',
6665
'fetch_html' = 'fetch_html',
6766
'ai_explain' = 'ai_explain'
6867
}

0 commit comments

Comments
 (0)