vease 0.1.0

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.
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <v-row class="fill-height pa-5">
3
+ <v-col cols="12">
4
+ <v-card style="height: 100%; width: 100%">
5
+ <RemoteRenderingView />
6
+ </v-card>
7
+ </v-col>
8
+ </v-row>
9
+ </template>
10
+
11
+ <script setup>
12
+ const infra_store = use_infra_store();
13
+ const geode_store = use_geode_store();
14
+ const viewer_store = use_viewer_store();
15
+
16
+ onMounted(async () => {
17
+ await infra_store.create_connexion();
18
+ geode_store.ping_task();
19
+ viewer_store.ws_connect();
20
+ });
21
+ </script>
22
+
23
+ <style>
24
+ html {
25
+ overflow-y: auto;
26
+ }
27
+ </style>
@@ -0,0 +1 @@
1
+ <template></template>
@@ -0,0 +1 @@
1
+ <template></template>
@@ -0,0 +1 @@
1
+ <template></template>
Binary file
@@ -0,0 +1,77 @@
1
+ import { readFiles } from "h3-formidable";
2
+ import { errors as formidableErrors } from "formidable";
3
+ import path from "path";
4
+ import fs from "fs";
5
+
6
+ export default defineEventHandler(async (event) => {
7
+ const maxFiles = 1;
8
+ const fileSize = 1024 * 1024 * 5; // 5MB
9
+
10
+ try {
11
+ const { files } = await readFiles(event, {
12
+ maxFiles: maxFiles,
13
+ maxFileSize: fileSize,
14
+ });
15
+
16
+ if (!Object.keys(files).length) {
17
+ throw createError({
18
+ statusMessage: "2001",
19
+ statusCode: 400,
20
+ });
21
+ }
22
+
23
+ for (let index = 0; index < Object.keys(files).length; index++) {
24
+ const filepath = files[index][0].filepath;
25
+ const mimetype = files[index][0].mimetype;
26
+
27
+ if (!mimetype.startsWith("image")) {
28
+ throw createError({
29
+ statusMessage: "2002",
30
+ statusCode: 400,
31
+ });
32
+ }
33
+
34
+ let imageName = `${String(Date.now()) + String(Math.round(Math.random() * 10000000))}.${mimetype.split("/")[1]}`;
35
+ let newPath = path.join("upload", imageName);
36
+ fs.copyFileSync(filepath, newPath);
37
+ }
38
+
39
+ return {
40
+ status: 200,
41
+ message: "Upload image successfully."
42
+ }
43
+ } catch (error) {
44
+ if (error.message === "2001") {
45
+ throw createError({
46
+ statusMessage: "File is required.",
47
+ statusCode: 400,
48
+ });
49
+ }
50
+
51
+ if (error.message === "2002") {
52
+ throw createError({
53
+ statusMessage: "Only image allowed.",
54
+ statusCode: 400,
55
+ });
56
+ }
57
+
58
+ if (error.code === formidableErrors.maxFilesExceeded) {
59
+ throw createError({
60
+ statusMessage: `Can't upload more than ${maxFiles} image.`,
61
+ statusCode: 400,
62
+ });
63
+ }
64
+
65
+ if (error.code === formidableErrors.biggerThanTotalMaxFileSize) {
66
+ throw createError({
67
+ statusMessage: `File is larger than ${(fileSize / (1024 * 1024))} MB.`,
68
+ statusCode: 400,
69
+ });
70
+ }
71
+
72
+ throw createError({
73
+ statusMessage: "An unknown error occurred",
74
+ statusCode: 500
75
+ });
76
+ }
77
+ });
@@ -0,0 +1,13 @@
1
+ export const useUserStore = defineStore("userStore", {
2
+ state: () => ({
3
+ firstName: "",
4
+ lastName: "",
5
+ email: "",
6
+ password: "",
7
+ image: "",
8
+ }),
9
+ actions: {
10
+ fetchUserData() {},
11
+ updateProfile() {},
12
+ },
13
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ // https://v3.nuxtjs.org/concepts/typescript
3
+ "extends": "./.nuxt/tsconfig.json"
4
+ }