mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 09:38:19 +08:00
core: add provideModule and injectUI API
This commit is contained in:
1 parent
672c553f4c
commit
28f03dbcbd
18 files changed
+211
-97
No files matched your search
@@ -1,6 +1,5 @@
|
||||
import 'hydrooj';
|
||||
|
||||
import superagent from 'superagent';
|
||||
import { PluginContext } from 'hydrooj';
|
||||
import { ForbiddenError } from 'hydrooj/src/error';
|
||||
|
||||
declare module 'hydrooj' {
|
||||
@@ -9,9 +8,6 @@ declare module 'hydrooj' {
|
||||
'login-with-github.secret': string;
|
||||
'login-with-github.endpoint': string;
|
||||
}
|
||||
interface Lib {
|
||||
oauth_github: typeof import('./lib');
|
||||
}
|
||||
}
|
||||
|
||||
async function get() {
|
||||
@@ -75,8 +71,10 @@ async function callback({ state, code }) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
global.Hydro.lib.oauth_github = {
|
||||
text: 'Login with Github',
|
||||
callback,
|
||||
get,
|
||||
};
|
||||
export function apply(ctx:PluginContext) {
|
||||
ctx.provideModule('oauth', 'github', {
|
||||
text: 'Login with Github',
|
||||
callback,
|
||||
get,
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user