core&ui: add addon not found warning

This commit is contained in:
undefined committed 2022-10-26 23:24:02 +08:00
1 parent 2d1c218999
commit 6a4aa14016
5 files changed
+9 -3

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "4.2.10", "version": "4.2.11",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "src/plugin-api", "main": "src/plugin-api",
"module": "src/plugin-api", "module": "src/plugin-api",
+1 -1
View File
@@ -695,7 +695,7 @@ export interface Lib extends Record<string, any> {
problemSearch: ProblemSearch; problemSearch: ProblemSearch;
} }
export type UIInjectableFields = 'ProblemAdd' | 'Nav' | 'UserDropdown' | 'DomainManage' | 'ControlPanel'; export type UIInjectableFields = 'ProblemAdd' | 'Notification' | 'Nav' | 'UserDropdown' | 'DomainManage' | 'ControlPanel';
export interface UI { export interface UI {
template: Record<string, string>, template: Record<string, string>,
nodes: Record<UIInjectableFields, any[]>, nodes: Record<UIInjectableFields, any[]>,
+3
View File
@@ -16,6 +16,8 @@ import { Logger } from './logger';
import { Context } from './context'; import { Context } from './context';
// eslint-disable-next-line import/no-duplicates // eslint-disable-next-line import/no-duplicates
import { unwrapExports } from './utils'; import { unwrapExports } from './utils';
import { PRIV } from './model/builtin';
import { inject } from './lib/ui';
const argv = cac().parse(); const argv = cac().parse();
const logger = new Logger('loader'); const logger = new Logger('loader');
@@ -95,6 +97,7 @@ export function addon(addonPath: string, prepend = false) {
} catch (e) { } catch (e) {
logger.error(`Addon not found: ${addonPath}`); logger.error(`Addon not found: ${addonPath}`);
logger.error(e); logger.error(e);
inject('Notification', 'Addon not found: {0}', { args: [addonPath] }, PRIV.PRIV_VIEW_SYSTEM_NOTIFICATION);
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/ui-default", "name": "@hydrooj/ui-default",
"version": "4.42.8", "version": "4.42.9",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "index.ts", "main": "index.ts",
@@ -6,6 +6,9 @@
<div class="slideout-overlay"></div> <div class="slideout-overlay"></div>
{% if UserContext %}{% include "partials/header_mobile.html" %}{% endif %} {% if UserContext %}{% include "partials/header_mobile.html" %}{% endif %}
<div class="main"> <div class="main">
{% for item in ui.getNodes('Notification') %}{% if item.checker(handler) %}
<div class="row"><blockquote class="warn">{{ _(item.name).format(item.args.args or []) }}</blockquote></div>
{% endif %}{% endfor %}
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>
{% include "partials/footer.html" %} {% include "partials/footer.html" %}