@hostlink/nuxt-light 0.0.58 → 0.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/module.mjs +0 -1
- package/dist/runtime/components/l-btn.vue +6 -5
- package/dist/runtime/components/l-login.vue +15 -1
- package/dist/runtime/components/l-table.vue +2 -2
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.mjs +0 -1
- package/dist/runtime/lib/getCurrentUser.mjs +1 -1
- package/dist/runtime/lib/index.d.ts +1 -2
- package/dist/runtime/lib/index.mjs +0 -2
- package/dist/runtime/pages/EventLog/_eventlog_id/view.vue +22 -1
- package/dist/runtime/pages/Permission/add.vue +4 -13
- package/dist/runtime/pages/User/setting/bio-auth.vue +81 -4
- package/package.json +2 -3
- package/dist/runtime/lib/mutation.d.ts +0 -1
- package/dist/runtime/lib/mutation.mjs +0 -12
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref, useAttrs } from "vue";
|
|
3
3
|
import { q, f, useLight } from '../';
|
|
4
|
-
import { useI18n } from "vue-i18n"
|
|
5
|
-
const i18n = useI18n()
|
|
6
4
|
|
|
7
|
-
const props = defineProps(["
|
|
5
|
+
const props = defineProps(["label", "permission"]);
|
|
8
6
|
|
|
9
|
-
const
|
|
7
|
+
const label = ref(props.label);
|
|
8
|
+
if (!label.value) {
|
|
9
|
+
label.value = "";
|
|
10
|
+
}
|
|
10
11
|
|
|
11
|
-
const
|
|
12
|
+
const light = useLight();
|
|
12
13
|
|
|
13
14
|
const granted = ref(false);
|
|
14
15
|
if (props.permission) {
|
|
@@ -4,7 +4,7 @@ import { useQuasar } from 'quasar';
|
|
|
4
4
|
import { useI18n } from 'vue-i18n';
|
|
5
5
|
import { m, notify } from '../';
|
|
6
6
|
|
|
7
|
-
import { login } from '@hostlink/light';
|
|
7
|
+
import { login, webauthnLogin } from '@hostlink/light';
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
defineProps({
|
|
@@ -105,7 +105,20 @@ const forgetPassword = async () => {
|
|
|
105
105
|
});
|
|
106
106
|
};
|
|
107
107
|
|
|
108
|
+
const hasBioLogin = ref(false);
|
|
108
109
|
|
|
110
|
+
if (localStorage.getItem("username")) {
|
|
111
|
+
hasBioLogin.value = true;
|
|
112
|
+
}
|
|
113
|
+
const bioLogin = async () => {
|
|
114
|
+
try {
|
|
115
|
+
await webauthnLogin(localStorage.getItem("username"));
|
|
116
|
+
window.self.location.reload();
|
|
117
|
+
} catch (e) {
|
|
118
|
+
notify(e.message, "negative");
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
}
|
|
109
122
|
|
|
110
123
|
</script>
|
|
111
124
|
|
|
@@ -129,6 +142,7 @@ const forgetPassword = async () => {
|
|
|
129
142
|
</q-card-section>
|
|
130
143
|
<q-card-actions>
|
|
131
144
|
<l-btn label="Login" outline rounded color="primary" icon="sym_o_login" @click="submit" />
|
|
145
|
+
<l-btn v-if="hasBioLogin" outline rounded color="primary" icon="sym_o_fingerprint" @click="bioLogin" />
|
|
132
146
|
<l-btn label="Forget password" outline rounded color="primary" icon="sym_o_lock_reset" @click="forgetPassword" />
|
|
133
147
|
</q-card-actions>
|
|
134
148
|
</q-card>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useQuasar, QTable } from 'quasar';
|
|
3
|
-
//import { useI18n } from 'vue-i18n';
|
|
4
3
|
import { useRoute } from 'vue-router';
|
|
5
4
|
import { ref, computed, onMounted, useSlots, reactive, useAttrs } from "vue";
|
|
6
5
|
import { t, deleteObject, q, f, useLight } from '../';
|
|
@@ -369,6 +368,7 @@ const attrs = {
|
|
|
369
368
|
...useAttrs()
|
|
370
369
|
}
|
|
371
370
|
|
|
371
|
+
|
|
372
372
|
</script>
|
|
373
373
|
<template>
|
|
374
374
|
<template v-if="errors.length > 0">
|
|
@@ -381,7 +381,7 @@ const attrs = {
|
|
|
381
381
|
|
|
382
382
|
<q-table v-bind="$attrs" :flat="attrs.flat" :dense="attrs.dense" :bordered="attrs.bordered" :row-key="rowKey"
|
|
383
383
|
:loading="loading" :hide-bottom="hideBottom" v-model:pagination="pagination" ref="table" @request="onRequest"
|
|
384
|
-
:rows="rows" :rows-per-page-label="t(props.rowsPerPageLabel)" :columns="renderColumns"
|
|
384
|
+
:rows="rows" :rows-per-page-label="$t(props.rowsPerPageLabel)" :columns="renderColumns"
|
|
385
385
|
:rows-per-page-options="rowsPerPageOptions"
|
|
386
386
|
:selection="selection"
|
|
387
387
|
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ interface Light {
|
|
|
7
7
|
getVersion(): string;
|
|
8
8
|
}
|
|
9
9
|
export declare function useLight(): Light;
|
|
10
|
-
export { notify, addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, m,
|
|
10
|
+
export { notify, addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, m, q, removeObject, t, updateObject, getID, deleteObject, listObject, getApiBase } from "./lib";
|
package/dist/runtime/index.mjs
CHANGED
|
@@ -7,7 +7,6 @@ import id from "./id";
|
|
|
7
7
|
import list from "./list";
|
|
8
8
|
import listData from "./listData";
|
|
9
9
|
import m from "./m";
|
|
10
|
-
import mutation from "./mutation";
|
|
11
10
|
import q from "./q";
|
|
12
11
|
import removeObject from "./removeObject";
|
|
13
12
|
import deleteObject from "./deleteObject";
|
|
@@ -18,4 +17,4 @@ import isGranted from "./isGranted";
|
|
|
18
17
|
declare const notify: (message: string, color?: string) => void;
|
|
19
18
|
import getID from "./getID";
|
|
20
19
|
declare const getApiBase: () => {};
|
|
21
|
-
export { addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, m,
|
|
20
|
+
export { addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, m, q, removeObject, t, updateObject, notify, getID, deleteObject, listObject, isGranted, getApiBase };
|
|
@@ -9,7 +9,6 @@ import id from "./id.mjs";
|
|
|
9
9
|
import list from "./list.mjs";
|
|
10
10
|
import listData from "./listData.mjs";
|
|
11
11
|
import m from "./m.mjs";
|
|
12
|
-
import mutation from "./mutation.mjs";
|
|
13
12
|
import q from "./q.mjs";
|
|
14
13
|
import removeObject from "./removeObject.mjs";
|
|
15
14
|
import deleteObject from "./deleteObject.mjs";
|
|
@@ -39,7 +38,6 @@ export {
|
|
|
39
38
|
list,
|
|
40
39
|
listData,
|
|
41
40
|
m,
|
|
42
|
-
mutation,
|
|
43
41
|
q,
|
|
44
42
|
removeObject,
|
|
45
43
|
t,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { getObject } from "../../../"
|
|
3
|
-
const obj = await getObject(["eventlog_id", "class", "id", "action", "created_time", "username"]);
|
|
3
|
+
const obj = await getObject(["eventlog_id", "class", "id", "action", "created_time", "username", "source", "target"]);
|
|
4
4
|
</script>
|
|
5
5
|
<template>
|
|
6
6
|
<l-page>
|
|
@@ -12,7 +12,28 @@ const obj = await getObject(["eventlog_id", "class", "id", "action", "created_ti
|
|
|
12
12
|
<l-item label="Action">{{ obj.action }}</l-item>
|
|
13
13
|
<l-item label="Created time">{{ obj.created_time }}</l-item>
|
|
14
14
|
<l-item label="Username">{{ obj.username }}</l-item>
|
|
15
|
+
|
|
16
|
+
<q-item>
|
|
17
|
+
<q-item-section>
|
|
18
|
+
<q-item-label>{{ $t('Source') }}</q-item-label>
|
|
19
|
+
<q-item-label caption>
|
|
20
|
+
<pre>{{ obj.source }}</pre>
|
|
21
|
+
</q-item-label>
|
|
22
|
+
</q-item-section>
|
|
23
|
+
</q-item>
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
<q-item>
|
|
27
|
+
<q-item-section>
|
|
28
|
+
<q-item-label>{{ $t('Target') }}</q-item-label>
|
|
29
|
+
<q-item-label caption style="white-space: pre-wrap;">
|
|
30
|
+
{{ obj.target }}
|
|
31
|
+
</q-item-label>
|
|
32
|
+
</q-item-section>
|
|
33
|
+
</q-item>
|
|
15
34
|
</l-list>
|
|
16
35
|
</l-card>
|
|
36
|
+
|
|
37
|
+
|
|
17
38
|
</l-page>
|
|
18
39
|
</template>
|
|
@@ -15,21 +15,12 @@ roles = roles.map((role) => {
|
|
|
15
15
|
|
|
16
16
|
const router = useRouter();
|
|
17
17
|
const onSave = async () => {
|
|
18
|
-
await mutation({
|
|
19
|
-
operation: "addPermissionRoles",
|
|
20
|
-
variables: {
|
|
21
|
-
value: {
|
|
22
|
-
value: obj.value,
|
|
23
|
-
required: true
|
|
24
|
-
},
|
|
25
|
-
roles: {
|
|
26
|
-
value: obj.roles,
|
|
27
|
-
type: "[String!]!"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
|
|
31
18
|
|
|
19
|
+
await m("addPermissionRoles", {
|
|
20
|
+
value: obj.value,
|
|
21
|
+
roles: obj.roles
|
|
32
22
|
});
|
|
23
|
+
|
|
33
24
|
router.push(`/Permission`);
|
|
34
25
|
}
|
|
35
26
|
|
|
@@ -1,13 +1,90 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { Dialog } from "quasar";
|
|
3
|
+
import { ref } from "vue"
|
|
4
|
+
import { q, m, getCurrentUser } from '../../../'
|
|
5
|
+
const app = await q("app", ["hasBioAuth"]);
|
|
6
|
+
|
|
7
|
+
import { webauthnRegister } from "@hostlink/light"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const data = ref(await q("listWebAuthn", ["uuid", "ip", "user_agent", "createdTime"]));
|
|
11
|
+
|
|
12
|
+
const register = async () => {
|
|
13
|
+
try {
|
|
14
|
+
await webauthnRegister();
|
|
15
|
+
data.value = await q("listWebAuthn", ["uuid", "ip", "user_agent", "createdTime"]);
|
|
16
|
+
const user = await getCurrentUser();
|
|
17
|
+
localStorage.setItem("username", user.username);
|
|
18
|
+
} catch (e) {
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const columns = [
|
|
24
|
+
{
|
|
25
|
+
name: "action",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: "Created time",
|
|
29
|
+
name: "createdTime",
|
|
30
|
+
field: "createdTime",
|
|
31
|
+
align: "left",
|
|
32
|
+
sortable: true
|
|
33
|
+
|
|
34
|
+
}, {
|
|
35
|
+
label: "IP",
|
|
36
|
+
name: "ip",
|
|
37
|
+
field: "ip", align: "left",
|
|
38
|
+
sortable: true
|
|
39
|
+
}, {
|
|
40
|
+
label: "User agent",
|
|
41
|
+
name: "user_agent",
|
|
42
|
+
field: "user_agent", align: "left",
|
|
43
|
+
sortable: true
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
const deleteItem = async (uuid) => {
|
|
48
|
+
//confirm
|
|
49
|
+
Dialog.create({
|
|
50
|
+
title: "Delete",
|
|
51
|
+
message: "Are you sure you want to delete this item?",
|
|
52
|
+
ok: "Yes",
|
|
53
|
+
cancel: "No",
|
|
54
|
+
}).onOk(async () => {
|
|
55
|
+
await m("deleteWebAuthn", { uuid });
|
|
56
|
+
data.value = await q("listWebAuthn", ["uuid", "ip", "user_agent", "createdTime"]);
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
4
62
|
</script>
|
|
5
63
|
<template>
|
|
6
64
|
<l-card :bordered="false">
|
|
7
|
-
|
|
8
|
-
|
|
9
65
|
<q-card-section v-if="!app.hasBioAuth">
|
|
10
66
|
Biometric authentication is not installed, please install web-auth/webauthn-lib on the server.
|
|
11
67
|
</q-card-section>
|
|
68
|
+
|
|
69
|
+
<template v-else>
|
|
70
|
+
<q-card-section>
|
|
71
|
+
<l-btn label="Register" @click="register" icon="sym_o_add"></l-btn>
|
|
72
|
+
</q-card-section>
|
|
73
|
+
|
|
74
|
+
<q-table :rows="data" :columns="columns">
|
|
75
|
+
<template #body-cell-action="props">
|
|
76
|
+
<q-td :props="props" auto-width>
|
|
77
|
+
<q-btn @click="deleteItem(props.row.uuid)" icon="sym_o_delete" round flat dense></q-btn>
|
|
78
|
+
</q-td>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
</q-table>
|
|
83
|
+
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
12
89
|
</l-card>
|
|
13
90
|
</template>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hostlink/nuxt-light",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.60",
|
|
4
4
|
"description": "HostLink Nuxt Light Framework",
|
|
5
5
|
"repository": "@hostlink/nuxt-light",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,8 +34,7 @@
|
|
|
34
34
|
"route-gen": "node route-generate.mjs"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@
|
|
38
|
-
"@hostlink/light": "^0.0.7",
|
|
37
|
+
"@hostlink/light": "^0.0.12",
|
|
39
38
|
"@nuxt/kit": "^3.7.0",
|
|
40
39
|
"@quasar/extras": "^1.16.6",
|
|
41
40
|
"axios": "^1.5.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function (options: any): Promise<any>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { mutation } from "gql-query-builder";
|
|
3
|
-
export default async function(options) {
|
|
4
|
-
let service = axios.create({
|
|
5
|
-
withCredentials: true
|
|
6
|
-
});
|
|
7
|
-
const data = (await service.post("/api/", mutation(options))).data;
|
|
8
|
-
if (data.errors) {
|
|
9
|
-
throw new Error(data.errors[0].message);
|
|
10
|
-
}
|
|
11
|
-
return data;
|
|
12
|
-
}
|