upgrade to cordis v3 (#733)

Co-authored-by: panda <panda_dtdyy@outlook.com>
This commit is contained in:
undefinedandpanda authored and GitHub committed 2024-03-07 01:32:58 +08:00
1 parent 498cd57016
commit a56b1650be
33 files changed
+301 -262

No files matched your search

+9 -4
View File
@@ -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);
}