Skip to content

Commit 306ab3f

Browse files
authored
Merge pull request #419 from sheepzh/alias_comp
Complete alias of sites
2 parents b59be1f + 2ba58ae commit 306ab3f

File tree

23 files changed

+329
-219
lines changed

23 files changed

+329
-219
lines changed

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,15 @@
3333
"@rsdoctor/webpack-plugin": "^0.4.13",
3434
"@swc/core": "^1.11.8",
3535
"@swc/jest": "^0.2.37",
36-
"@types/chrome": "0.0.308",
36+
"@types/chrome": "0.0.309",
3737
"@types/decompress": "^4.2.7",
3838
"@types/echarts": "^5.0.0",
3939
"@types/generate-json-webpack-plugin": "^0.3.7",
4040
"@types/jest": "^29.5.14",
41-
"@types/node": "^22.13.9",
42-
"@types/psl": "^1.1.3",
41+
"@types/node": "^22.13.10",
4342
"@types/punycode": "^2.1.4",
4443
"@types/webpack": "^5.28.5",
45-
"@vue/babel-plugin-jsx": "^1.3.0",
44+
"@vue/babel-plugin-jsx": "^1.4.0",
4645
"babel-loader": "^10.0.0",
4746
"copy-webpack-plugin": "^13.0.0",
4847
"css-loader": "^7.1.2",
@@ -72,7 +71,7 @@
7271
},
7372
"dependencies": {
7473
"@element-plus/icons-vue": "^2.3.1",
75-
"@vueuse/core": "^12.8.2",
74+
"@vueuse/core": "^13.0.0",
7675
"countup.js": "^2.8.0",
7776
"echarts": "^5.6.0",
7877
"element-plus": "2.9.6",

src/background/icon-and-alias-collector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async function collectAlias(key: timer.site.SiteKey, tabTitle: string) {
2929
if (!tabTitle) return
3030
if (isUrl(tabTitle)) return
3131
const siteName = extractSiteName(tabTitle, key.host)
32-
siteName && await siteService.saveAlias(key, siteName, 'DETECTED')
32+
siteName && await siteService.saveAlias(key, siteName)
3333
}
3434

3535
/**

src/background/migrator/local-file-initializer.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
*/
77

88
import MergeRuleDatabase from "@db/merge-rule-database"
9-
import { JSON_HOST, LOCAL_HOST_PATTERN, MERGED_HOST, PDF_HOST, PIC_HOST, TXT_HOST } from "@util/constant/remain-host"
109
import { t2Chrome } from "@i18n/chrome/t"
1110
import siteService from "@service/site-service"
11+
import { JSON_HOST, LOCAL_HOST_PATTERN, MERGED_HOST, PDF_HOST, PIC_HOST, TXT_HOST } from "@util/constant/remain-host"
1212
import { type Migrator } from "./common"
1313

1414
const mergeRuleDatabase = new MergeRuleDatabase(chrome.storage.local)
@@ -32,22 +32,18 @@ export default class LocalFileInitializer implements Migrator {
3232
siteService.saveAlias(
3333
{ host: PDF_HOST, type: 'normal' },
3434
t2Chrome(msg => msg.initial.localFile.pdf),
35-
'DETECTED'
3635
)
3736
siteService.saveAlias(
3837
{ host: JSON_HOST, type: 'normal' },
3938
t2Chrome(msg => msg.initial.localFile.json),
40-
'DETECTED'
4139
)
4240
siteService.saveAlias(
4341
{ host: PIC_HOST, type: 'normal' },
4442
t2Chrome(msg => msg.initial.localFile.pic),
45-
'DETECTED'
4643
)
4744
siteService.saveAlias(
4845
{ host: TXT_HOST, type: 'normal' },
4946
t2Chrome(msg => msg.initial.localFile.txt),
50-
'DETECTED'
5147
)
5248
}
5349
}

src/database/site-database.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import BaseDatabase from "./common/base-database"
1010
import { REMAIN_WORD_PREFIX } from "./common/constant"
1111

1212
export type SiteCondition = {
13-
host?: string
14-
alias?: string
1513
/**
1614
* Fuzzy query of host or alias
1715
*/
@@ -75,12 +73,11 @@ function cvt2SiteKey(key: string): timer.site.SiteKey {
7573
}
7674
}
7775

78-
function cvt2Entry({ alias, source, iconUrl, cate, run }: timer.site.SiteInfo): _Entry {
76+
function cvt2Entry({ alias, iconUrl, cate, run }: timer.site.SiteInfo): _Entry {
7977
const entry: _Entry = { i: iconUrl }
8078
alias && (entry.a = alias)
8179
cate && (entry.c = cate)
8280
run && (entry.r = true)
83-
source === 'DETECTED' && (entry.d = true)
8481
entry.i = iconUrl
8582
return entry
8683
}
@@ -93,8 +90,6 @@ function cvt2SiteInfo(key: timer.site.SiteKey, entry: _Entry): timer.site.SiteIn
9390
siteInfo.cate = c
9491
siteInfo.iconUrl = i
9592
siteInfo.run = !!r
96-
// Only exist if alias is not empty
97-
a && (siteInfo.source = d ? 'DETECTED' : 'USER')
9893
return siteInfo
9994
}
10095

@@ -119,13 +114,11 @@ async function select(this: SiteDatabase, condition?: SiteCondition): Promise<ti
119114
}
120115

121116
function buildFilter(condition: SiteCondition): (site: timer.site.SiteInfo) => boolean {
122-
const { host, alias, fuzzyQuery, cateIds, types } = condition || {}
117+
const { fuzzyQuery, cateIds, types } = condition || {}
123118
let cateFilter = typeof cateIds === 'number' ? [cateIds] : (cateIds?.length ? cateIds : undefined)
124119
let typeFilter = typeof types === 'string' ? [types] : (types?.length ? types : undefined)
125120
return site => {
126121
const { host: siteHost, alias: siteAlias, cate, type } = site || {}
127-
if (host && !siteHost.includes(host)) return false
128-
if (alias && !siteAlias?.includes(alias)) return false
129122
if (fuzzyQuery && !(siteHost?.includes(fuzzyQuery) || siteAlias?.includes(fuzzyQuery))) return false
130123
if (cateFilter && (!cateFilter.includes(cate ?? CATE_NOT_SET_ID) || type !== 'normal')) return false
131124
if (typeFilter && !matchType(typeFilter, site)) return false

src/i18n/message/app/site-manage-resource.json

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
{
22
"zh_CN": {
3-
"hostPlaceholder": "请输入域名,然后回车",
4-
"aliasPlaceholder": "请输入网站名,然后回车",
53
"deleteConfirmMsg": "{host} 的名称设置将会被删除",
4+
"genAliasConfirmMsg": "是否自动批量补全站点名称?",
65
"column": {
76
"type": "网站类型",
87
"alias": "网站名称",
9-
"aliasInfo": "网站名称会在报表以及今日数据(需要在扩展选项里设置)里展示,方便您快速识别域名",
108
"cate": "网站类目",
119
"icon": "网站图标"
1210
},
@@ -24,7 +22,6 @@
2422
"info": "统计 Ant Pattern 格式的任意 URL,可以在右上角新增自定义站点"
2523
}
2624
},
27-
"detected": "自动抓取",
2825
"cate": {
2926
"name": "类目名称",
3027
"relatedMsg": "该类目已有 {siteCount} 个站点,无法删除",
@@ -46,13 +43,10 @@
4643
}
4744
},
4845
"zh_TW": {
49-
"hostPlaceholder": "請輸入網域,然後回車",
50-
"aliasPlaceholder": "請輸入網站名,然後回車",
5146
"deleteConfirmMsg": "{host} 的將會被刪除",
5247
"column": {
5348
"type": "網站類型",
5449
"alias": "網站名稱",
55-
"aliasInfo": "網站名稱會在報表以及今日數據(需要在擴充選項裡設置)裡展示,方便您快速識別網域",
5650
"cate": "網站類別",
5751
"icon": "網站圖標"
5852
},
@@ -70,7 +64,6 @@
7064
"info": "統計 Ant Pattern 格式的任意 URL,可以在右上角新增自定義站點"
7165
}
7266
},
73-
"detected": "自動偵測",
7467
"cate": {
7568
"name": "類別名稱",
7669
"relatedMsg": "此類別已與 {siteCount} 個網站關聯,無法刪除",
@@ -92,13 +85,11 @@
9285
}
9386
},
9487
"en": {
95-
"hostPlaceholder": "Partial URL, then enter",
96-
"aliasPlaceholder": "Partial name, then enter",
9788
"deleteConfirmMsg": "{host} will be deleted",
89+
"genAliasConfirmMsg": "Whether to automatically complete site names in batches?",
9890
"column": {
9991
"type": "Site Type",
10092
"alias": "Site Name",
101-
"aliasInfo": "The site name will be shown on the record page and the popup page",
10293
"cate": "Site Category",
10394
"icon": "Icon"
10495
},
@@ -116,7 +107,6 @@
116107
"info": "count any URL in Ant Pattern format, you can add a custom site in the upper right corner"
117108
}
118109
},
119-
"detected": "Automatically detected",
120110
"cate": {
121111
"name": "Name",
122112
"relatedMsg": "This category has been associated with {siteCount} sites and cannot be deleted",
@@ -138,13 +128,10 @@
138128
}
139129
},
140130
"ja": {
141-
"hostPlaceholder": "ドメイン名で検索",
142-
"aliasPlaceholder": "サイト名で検索",
143131
"deleteConfirmMsg": "{host} は削除されます",
144132
"column": {
145133
"type": "サイト種別",
146134
"alias": "サイト名",
147-
"aliasInfo": "サイト名はレコードページとポップアップページに表示されます",
148135
"cate": "サイトカテゴリー",
149136
"icon": "Icon"
150137
},
@@ -162,7 +149,6 @@
162149
"info": "Ant Pattern 形式の任意の URL をカウントします。右上隅にカスタムサイトを追加できます"
163150
}
164151
},
165-
"detected": "システム検出",
166152
"cate": {
167153
"name": "カテゴリ名",
168154
"relatedMsg": "このカテゴリは {siteCount} 個のサイトに関連付けられているため、削除できません",
@@ -184,13 +170,10 @@
184170
}
185171
},
186172
"pt_PT": {
187-
"hostPlaceholder": "URL parcial, e depois digite",
188-
"aliasPlaceholder": "Nome parcial, e depois digite",
189173
"deleteConfirmMsg": "{host} será excluído",
190174
"column": {
191175
"type": "Categoria de Sítio Web",
192176
"alias": "Nome do Site",
193-
"aliasInfo": "O nome do site será mostrado na página de registro e na página pop-up",
194177
"cate": "Categoria do site",
195178
"icon": "Ícone"
196179
},
@@ -208,7 +191,6 @@
208191
"info": "conta qualquer URL no formato Ant Pattern, pode adicionar um site personalizado no canto superior direito"
209192
}
210193
},
211-
"detected": "detetado",
212194
"cate": {
213195
"name": "Nome",
214196
"relatedMsg": "Esta categoria foi associada aos sites {siteCount} e não pode ser eliminada",
@@ -230,13 +212,10 @@
230212
}
231213
},
232214
"uk": {
233-
"hostPlaceholder": "Почніть вводити URL і натисніть Enter",
234-
"aliasPlaceholder": "Почніть вводити назву і натисніть Enter",
235215
"deleteConfirmMsg": "{host} буде видалено",
236216
"column": {
237217
"type": "Тип сайту",
238218
"alias": "Назва сайту",
239-
"aliasInfo": "Назву сайту буде показано на сторінці записів і в спливному вікні",
240219
"cate": "Категорія сайту",
241220
"icon": "Піктограма"
242221
},
@@ -254,7 +233,6 @@
254233
"info": "враховувати будь-яку URL-адресу в форматі параметрів Ant, ви можете додати свій сайт у верхньому правому куті"
255234
}
256235
},
257-
"detected": "auto-detected",
258236
"cate": {
259237
"name": "Назва",
260238
"relatedMsg": "Ця категорія була пов’язана з {siteCount} сайтами й не може бути видалена",
@@ -276,13 +254,10 @@
276254
}
277255
},
278256
"es": {
279-
"hostPlaceholder": "URL parcial, luego ingresa",
280-
"aliasPlaceholder": "Nombre parcial, luego ingresa",
281257
"deleteConfirmMsg": "Se eliminará {host}",
282258
"column": {
283259
"type": "Tipo de sitio",
284260
"alias": "Nombre del sitio",
285-
"aliasInfo": "El nombre del sitio se mostrará en la página de registro y en la página emergente",
286261
"cate": "Categoría del sitio",
287262
"icon": "Icono"
288263
},
@@ -300,7 +275,6 @@
300275
"info": "contar cualquier URL en formato Ant Pattern, puedes agregar un sitio personalizado en la esquina superior derecha"
301276
}
302277
},
303-
"detected": "auto-detectado",
304278
"cate": {
305279
"name": "Nombre",
306280
"relatedMsg": "Esta categoría se ha asociado con {siteCount} sitios y no se puede eliminar",
@@ -322,13 +296,10 @@
322296
}
323297
},
324298
"de": {
325-
"hostPlaceholder": "Suche nach URL",
326-
"aliasPlaceholder": "Suche mit Name",
327299
"deleteConfirmMsg": "{host} wird gelöscht",
328300
"column": {
329301
"type": "Website-Typ",
330302
"alias": "Site-Name",
331-
"aliasInfo": "Der Name der Website wird auf der Datensatzseite und der Popup-Seite angezeigt",
332303
"cate": "Seitenkategorie",
333304
"icon": "Symbol"
334305
},
@@ -346,7 +317,6 @@
346317
"info": "Wenn Sie eine beliebige URL im Ant-Pattern-Format zählen, können Sie in der oberen rechten Ecke eine benutzerdefinierte Site hinzufügen"
347318
}
348319
},
349-
"detected": "automatisch erkannt",
350320
"cate": {
351321
"name": "Namen",
352322
"relatedMsg": "Diese Kategorie wurde mit {siteCount} Seiten verknüpft und kann nicht gelöscht werden",
@@ -368,13 +338,10 @@
368338
}
369339
},
370340
"fr": {
371-
"hostPlaceholder": "URL partielle, appuyez sur Entrée",
372-
"aliasPlaceholder": "Nom partiel, appuyez sur Entrée",
373341
"deleteConfirmMsg": "{host} sera supprimé",
374342
"column": {
375343
"type": "Type de Site",
376344
"alias": "Nom du site",
377-
"aliasInfo": "Le nom du site sera affiché sur la page d'enregistrement et la page contextuelle",
378345
"cate": "Catégorie du site",
379346
"icon": "Icône"
380347
},
@@ -392,7 +359,6 @@
392359
"info": "comptez n'importe quelle URL au format Ant Pattern, vous pouvez ajouter un site personnalisé dans le coin supérieur droit"
393360
}
394361
},
395-
"detected": "détecté",
396362
"cate": {
397363
"name": "Nom",
398364
"relatedMsg": "Cette catégorie a été associée à {siteCount} sites et ne peut pas être supprimée",
@@ -414,13 +380,10 @@
414380
}
415381
},
416382
"ru": {
417-
"hostPlaceholder": "Частичный URL, затем введите",
418-
"aliasPlaceholder": "Частичное имя, затем введите",
419383
"deleteConfirmMsg": "{host} будет удален",
420384
"column": {
421385
"type": "Тип сайта",
422386
"alias": "Название сайта",
423-
"aliasInfo": "Название сайта будет показано на странице записи и всплывающей странице",
424387
"icon": "Иконки"
425388
},
426389
"type": {
@@ -437,7 +400,6 @@
437400
"info": "подсчитайте любой URL в формате Ant Pattern, вы можете добавить пользовательский сайт в правом верхнем углу"
438401
}
439402
},
440-
"detected": "выявленный",
441403
"form": {
442404
"emptyAlias": "Введите название сайта",
443405
"emptyHost": "Введите URL-адрес сайта"
@@ -448,13 +410,10 @@
448410
}
449411
},
450412
"ar": {
451-
"hostPlaceholder": "عنوان URL جزئي، ثم أدخل",
452-
"aliasPlaceholder": "الاسم الجزئي، ثم أدخل",
453413
"deleteConfirmMsg": "سيتم حذف {host}",
454414
"column": {
455415
"type": "نوع الموقع",
456416
"alias": "اسم الموقع",
457-
"aliasInfo": "سيتم عرض اسم الموقع على صفحة السجل وصفحة النافذة المنبثقة",
458417
"cate": "فئة الموقع",
459418
"icon": "رمز"
460419
},
@@ -472,7 +431,6 @@
472431
"info": "احسب أي عنوان URL بتنسيق Ant Pattern، ويمكنك إضافة موقع مخصص في الزاوية اليمنى العليا"
473432
}
474433
},
475-
"detected": "تم الكشف عنه تلقائيًا",
476434
"cate": {
477435
"name": "الاسم",
478436
"relatedMsg": "تم ربط هذه الفئة بمواقع {siteCount} ولا يمكن حذفها",

src/i18n/message/app/site-manage.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,15 @@
88
import resource from './site-manage-resource.json'
99

1010
export type SiteManageMessage = {
11-
hostPlaceholder: string
12-
aliasPlaceholder: string
1311
deleteConfirmMsg: string
12+
genAliasConfirmMsg: string
1413
column: {
1514
type: string
1615
alias: string
17-
aliasInfo: string
1816
cate: string
1917
icon: string
2018
}
2119
type: Record<timer.site.Type, Record<'name' | 'info', string>>
22-
detected: string
2320
cate: {
2421
name: string
2522
relatedMsg: string

src/pages/app/components/Limit/LimitFilter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const _default = defineComponent({
7171
<Flex gap={10}>
7272
<InputFilterItem
7373
defaultValue={url.value}
74-
placeholder="URL + ↵"
74+
placeholder={t(msg => msg.limit.item.condition)}
7575
onSearch={setUrl}
7676
/>
7777
<SwitchFilterItem

0 commit comments

Comments
 (0)