chore: create the authorize logs page

This commit is contained in:
FoskyM 2023-09-28 22:44:45 +08:00
parent 20311fbfed
commit d9458ba3ef
No known key found for this signature in database
GPG key ID: 42C0ED6994AD7E9C
6 changed files with 49 additions and 5 deletions

BIN
js/dist/forum.js generated vendored

Binary file not shown.

BIN
js/dist/forum.js.map generated vendored

Binary file not shown.

View file

@ -0,0 +1,13 @@
import UserPage from 'flarum/forum/components/UserPage';
export default class AuthorizePage extends UserPage {
oninit(vnode) {
super.oninit(vnode);
this.loadUser(m.route.param('username'));
}
content() {
return (
<div className="AuthorizePage">
</div>
);
}
}

29
js/src/forum/index.js Normal file
View file

@ -0,0 +1,29 @@
import app from 'flarum/forum/app';
import {extend} from 'flarum/common/extend';
import UserPage from 'flarum/forum/components/UserPage';
import LinkButton from 'flarum/common/components/LinkButton';
import AuthorizePage from "./components/user/AuthorizePage";
app.initializers.add('foskym/flarum-oauth-center', () => {
app.routes['user.authorize'] = {
path: '/u/:username/authorize',
component: AuthorizePage
};
extend(UserPage.prototype, 'navItems', function (items) {
if (app.session.user && app.session.user.id() === this.user.id()) {
items.add(
'authorize',
LinkButton.component(
{
href: app.route('user.authorize', { username: this.user.username() }),
icon: 'fas fa-user-friends',
},
[
app.translator.trans('foskym-oauth-center.forum.page.label.authorize'),
// this.user.moderatorNoteCount() > 0 ? <span className="Button-badge">{this.user.moderatorNoteCount()}</span> : '',
]
),
-110
);
}
});
});

View file

@ -1,5 +0,0 @@
import app from 'flarum/forum/app';
app.initializers.add('foskym/flarum-oauth-center', () => {
console.log('[foskym/flarum-oauth-center] Hello, forum!');
});

7
locale/zh-Hans.yml Normal file
View file

@ -0,0 +1,7 @@
foskym-oauth-center:
admin:
forum:
page:
label:
authorize: 授权