mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
fix: geoip模块dts异常及prepublish.sh不调用的问题
This commit is contained in:
1 parent
a1aeb521fe
commit
02c1866963
5 files changed
+10
-7
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import 'hydrooj';
|
||||
import 'hydrooj/src/lib/i18n';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { Reader } from 'maxmind';
|
||||
@@ -14,9 +15,9 @@ export interface Result {
|
||||
display: string
|
||||
}
|
||||
|
||||
export function lookup(ip: string, locale: string) {
|
||||
export function lookup(ip: string, locale: string): Result {
|
||||
const res: any = reader.get(ip);
|
||||
if (!res) return {};
|
||||
if (!res) return { display: 'Unknown address'.translate(locale) };
|
||||
const ret: Result = { display: '' };
|
||||
if (res.location) ret.location = res.location;
|
||||
if (res.continent) ret.continent = res.continent.names[locale] || res.continent.names.en;
|
||||
|
||||
Reference in new issue
Block a user