Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5b47ccf

Browse files
committed
feat(geolite): add GeoLite2 database checks and download functionality in self-check tasks
1 parentf967501 commit5b47ccf

File tree

26 files changed

+4092
-2140
lines changed

26 files changed

+4092
-2140
lines changed

‎.claude/settings.local.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"Bash(go generate:*)",
2020
"Bash(pnpm eslint:*)",
2121
"Read(//workspaces/cosy/settings/**)",
22-
"Bash(go doc:*)"
22+
"Bash(go doc:*)",
23+
"Bash(pnpm exec eslint:*)"
2324
],
2425
"deny": []
2526
}

‎app/components.d.ts‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ declare module 'vue' {
1111
AAlert:typeofimport('ant-design-vue/es')['Alert']
1212
AApp:typeofimport('ant-design-vue/es')['App']
1313
AAutoComplete:typeofimport('ant-design-vue/es')['AutoComplete']
14-
AAvatar:typeofimport('ant-design-vue/es')['Avatar']
1514
ABadge:typeofimport('ant-design-vue/es')['Badge']
1615
ABreadcrumb:typeofimport('ant-design-vue/es')['Breadcrumb']
1716
ABreadcrumbItem:typeofimport('ant-design-vue/es')['BreadcrumbItem']
@@ -22,7 +21,6 @@ declare module 'vue' {
2221
ACol:typeofimport('ant-design-vue/es')['Col']
2322
ACollapse:typeofimport('ant-design-vue/es')['Collapse']
2423
ACollapsePanel:typeofimport('ant-design-vue/es')['CollapsePanel']
25-
AComment:typeofimport('ant-design-vue/es')['Comment']
2624
AConfigProvider:typeofimport('ant-design-vue/es')['ConfigProvider']
2725
ADivider:typeofimport('ant-design-vue/es')['Divider']
2826
ADrawer:typeofimport('ant-design-vue/es')['Drawer']
@@ -32,8 +30,6 @@ declare module 'vue' {
3230
AFormItem:typeofimport('ant-design-vue/es')['FormItem']
3331
AInput:typeofimport('ant-design-vue/es')['Input']
3432
AInputGroup:typeofimport('ant-design-vue/es')['InputGroup']
35-
AInputNumber:typeofimport('ant-design-vue/es')['InputNumber']
36-
AInputPassword:typeofimport('ant-design-vue/es')['InputPassword']
3733
ALayout:typeofimport('ant-design-vue/es')['Layout']
3834
ALayoutContent:typeofimport('ant-design-vue/es')['LayoutContent']
3935
ALayoutFooter:typeofimport('ant-design-vue/es')['LayoutFooter']
@@ -43,25 +39,19 @@ declare module 'vue' {
4339
AListItem:typeofimport('ant-design-vue/es')['ListItem']
4440
AListItemMeta:typeofimport('ant-design-vue/es')['ListItemMeta']
4541
AMenu:typeofimport('ant-design-vue/es')['Menu']
46-
AMenuDivider:typeofimport('ant-design-vue/es')['MenuDivider']
4742
AMenuItem:typeofimport('ant-design-vue/es')['MenuItem']
4843
AModal:typeofimport('ant-design-vue/es')['Modal']
4944
APopconfirm:typeofimport('ant-design-vue/es')['Popconfirm']
5045
APopover:typeofimport('ant-design-vue/es')['Popover']
5146
AppProviderAppProvider:typeofimport('./src/components/AppProvider/AppProvider.vue')['default']
5247
AProgress:typeofimport('ant-design-vue/es')['Progress']
53-
AQrcode:typeofimport('ant-design-vue/es')['QRCode']
5448
ARangePicker:typeofimport('ant-design-vue/es')['RangePicker']
55-
AResult:typeofimport('ant-design-vue/es')['Result']
5649
ARow:typeofimport('ant-design-vue/es')['Row']
5750
ASegmented:typeofimport('ant-design-vue/es')['Segmented']
5851
ASelect:typeofimport('ant-design-vue/es')['Select']
5952
ASelectOption:typeofimport('ant-design-vue/es')['SelectOption']
6053
ASpace:typeofimport('ant-design-vue/es')['Space']
61-
ASpin:typeofimport('ant-design-vue/es')['Spin']
6254
AStatistic:typeofimport('ant-design-vue/es')['Statistic']
63-
AStep:typeofimport('ant-design-vue/es')['Step']
64-
ASteps:typeofimport('ant-design-vue/es')['Steps']
6555
ASubMenu:typeofimport('ant-design-vue/es')['SubMenu']
6656
ASwitch:typeofimport('ant-design-vue/es')['Switch']
6757
ATable:typeofimport('ant-design-vue/es')['Table']
@@ -70,7 +60,6 @@ declare module 'vue' {
7060
ATag:typeofimport('ant-design-vue/es')['Tag']
7161
ATextarea:typeofimport('ant-design-vue/es')['Textarea']
7262
ATooltip:typeofimport('ant-design-vue/es')['Tooltip']
73-
ATypographyParagraph:typeofimport('ant-design-vue/es')['TypographyParagraph']
7463
ATypographyText:typeofimport('ant-design-vue/es')['TypographyText']
7564
ATypographyTitle:typeofimport('ant-design-vue/es')['TypographyTitle']
7665
AutoCertFormAutoCertForm:typeofimport('./src/components/AutoCertForm/AutoCertForm.vue')['default']
@@ -120,6 +109,7 @@ declare module 'vue' {
120109
ReactiveFromNowReactiveFromNow:typeofimport('./src/components/ReactiveFromNow/ReactiveFromNow.vue')['default']
121110
RouterLink:typeofimport('vue-router')['RouterLink']
122111
RouterView:typeofimport('vue-router')['RouterView']
112+
SelfCheckAsyncErrorDisplay:typeofimport('./src/components/SelfCheck/AsyncErrorDisplay.vue')['default']
123113
SelfCheckSelfCheck:typeofimport('./src/components/SelfCheck/SelfCheck.vue')['default']
124114
SelfCheckSelfCheckHeaderBanner:typeofimport('./src/components/SelfCheck/SelfCheckHeaderBanner.vue')['default']
125115
SensitiveStringSensitiveString:typeofimport('./src/components/SensitiveString/SensitiveString.vue')['default']

‎app/src/components/GeoLiteDownload/GeoLiteDownload.vue‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,7 @@ defineExpose({
156156
<divclass="space-y-2">
157157
<p>{{ $gettext('The GeoLite2 database is required for offline geographic IP analysis. Please download it to enable this feature.') }}</p>
158158
<pclass="text-sm">
159-
{{ $gettext('Alternatively, if you cannot download the database, you can manually place') }}
160-
<codeclass="px-1 py-0.5 bg-gray-200 dark:bg-gray-700 rounded">GeoLite2-City.mmdb</code>
161-
{{ $gettext('in the same directory as') }}
162-
<codeclass="px-1 py-0.5 bg-gray-200 dark:bg-gray-700 rounded">app.ini</code>
159+
{{ $gettext('Alternatively, if you cannot download the database, you can manually place GeoLite2-City.mmdb in the same directory as app.ini.') }}
163160
</p>
164161
</div>
165162
</template>
@@ -209,9 +206,6 @@ defineExpose({
209206
:percent="downloadProgressComputed"
210207
:status="downloadStatus"
211208
/>
212-
<ATypographyTextv-if="downloadMessage"type="secondary"class="text-sm mt-2">
213-
{{ downloadMessage }}
214-
</ATypographyText>
215209
</div>
216210
</div>
217211
</div>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<script setup lang="ts">
2+
importtype {CosyError }from'@/lib/http/types'
3+
import {translateError }from'@/lib/http/error'
4+
5+
const props=defineProps<{
6+
error:CosyError
7+
status:'warning'|'error'
8+
}>()
9+
10+
const translatedError=awaittranslateError(props.error)
11+
</script>
12+
13+
<template>
14+
<ATag:color="status === 'warning' ? 'warning' : 'error'">
15+
{{ translatedError }}
16+
</ATag>
17+
</template>

‎app/src/components/SelfCheck/SelfCheck.vue‎

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
11
<script setup lang="ts">
22
import {CheckCircleOutlined,CloseCircleOutlined,WarningOutlined }from'@ant-design/icons-vue'
3+
importGeoLiteDownloadfrom'@/components/GeoLiteDownload'
4+
importAsyncErrorDisplayfrom'./AsyncErrorDisplay.vue'
35
import {useSelfCheckStore }from'./store'
46
57
const store=useSelfCheckStore()
68
79
const { data, loading, fixing }=storeToRefs(store)
810
11+
const geoLiteModalVisible=ref(false)
12+
13+
function handleFix(key:string) {
14+
if (key==='GeoLite-DB') {
15+
geoLiteModalVisible.value=true
16+
}
17+
else {
18+
store.fix(key)
19+
}
20+
}
21+
22+
function handleGeoLiteDownloadComplete() {
23+
geoLiteModalVisible.value=false
24+
store.check()
25+
}
26+
927
onMounted(()=> {
1028
store.check()
1129
})
@@ -26,7 +44,7 @@ onMounted(() => {
2644
<AList>
2745
<AListItemv-for="(item, index) in data":key="index">
2846
<templatev-if="item.status==='error'&&item.fixable" #actions>
29-
<AButtontype="link"size="small":loading="fixing[item.key]"@click="store.fix(item.key)">
47+
<AButtontype="link"size="small":loading="fixing[item.key]"@click="handleFix(item.key)">
3048
{{ $gettext('Attempt to fix') }}
3149
</AButton>
3250
</template>
@@ -39,9 +57,14 @@ onMounted(() => {
3957
{{ item.description?.() }}
4058
</div>
4159
<divv-if="item.status !== 'success' && item.err?.message"class="mt-1">
42-
<ATag:color="item.status === 'warning' ? 'warning' : 'error'">
43-
{{ $gettext(item.err?.message) }}
44-
</ATag>
60+
<Suspense>
61+
<AsyncErrorDisplay:error="item.err":status="item.status" />
62+
<template #fallback>
63+
<ATag:color="item.status === 'warning' ? 'warning' : 'error'">
64+
{{ item.err.message }}
65+
</ATag>
66+
</template>
67+
</Suspense>
4568
</div>
4669
</template>
4770
<template #avatar>
@@ -54,6 +77,15 @@ onMounted(() => {
5477
</AListItemMeta>
5578
</AListItem>
5679
</AList>
80+
81+
<AModal
82+
v-model:open="geoLiteModalVisible"
83+
:title="$gettext('Download GeoLite2 Database')"
84+
:footer="null"
85+
width="600px"
86+
>
87+
<GeoLiteDownload@download-complete="handleGeoLiteDownloadComplete" />
88+
</AModal>
5789
</ACard>
5890
</template>
5991

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
exportdefault{
2+
60000:()=>$gettext('Failed to download GeoLite2 database: {0}'),
3+
60001:()=>$gettext('Failed to decompress GeoLite2 database: {0}'),
4+
60002:()=>$gettext('GeoLite2 database not found at {0}'),
5+
60003:()=>$gettext('Failed to get file size: {0}'),
6+
60004:()=>$gettext('Failed to create file: {0}'),
7+
60005:()=>$gettext('Failed to save downloaded file: {0}'),
8+
60006:()=>$gettext('Failed to open file: {0}'),
9+
60007:()=>$gettext('Failed to create xz reader: {0}'),
10+
60008:()=>$gettext('Failed to write decompressed data: {0}'),
11+
60009:()=>$gettext('Failed to read compressed data: {0}'),
12+
60010:()=>$gettext('Decompression succeeded but failed to delete compressed file: {0}'),
13+
}

‎app/src/constants/errors/self_check.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ export default {
2121
40417:()=>$gettext('Access log path not exist'),
2222
40418:()=>$gettext('Error log path not exist'),
2323
40419:()=>$gettext('Conf.d directory not exists'),
24+
40420:()=>$gettext('GeoLite2 database not found at {0}. Log indexing requires GeoLite2 database for geographic IP analysis'),
2425
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp