mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
upgrade to cordis v3 (#733)
Co-authored-by: panda <panda_dtdyy@outlook.com>
This commit is contained in:
1 parent
498cd57016
commit
a56b1650be
33 files changed
+301
-262
No files matched your search
@@ -13,7 +13,11 @@ export interface Result {
|
||||
display: string
|
||||
}
|
||||
|
||||
class GeoIPService extends Service {
|
||||
export default class GeoIPService extends Service {
|
||||
constructor(ctx: Context) {
|
||||
super(ctx, 'geoip', true);
|
||||
}
|
||||
|
||||
provider = '<a href="http://www.maxmind.com" target="_blank">MaxMind</a>';
|
||||
lookup(ip: string, locale: string): Result {
|
||||
const res: any = reader.get(ip);
|
||||
@@ -30,7 +34,8 @@ class GeoIPService extends Service {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
export function apply(ctx: Context) {
|
||||
Context.service('geoip', GeoIPService);
|
||||
ctx.geoip = new GeoIPService(ctx, 'geoip', true);
|
||||
|
||||
export async function apply(ctx: Context) {
|
||||
ctx.provide('geoip');
|
||||
ctx.geoip = new GeoIPService(ctx);
|
||||
}
|
||||
Reference in new issue
Block a user