diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 2c1f8de..92b04ce 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,8 +4,16 @@
-
-
+
+
+
+
+
+
+
+
+
+
@@ -59,7 +67,7 @@
"nodejs_package_manager_path": "npm",
"run.code.analysis.last.selected.profile": "pProject Default",
"settings.editor.selected.configurable": "preferences.pluginManager",
- "ts.external.directory.path": "/Users/littlesheep/Applications/GoLand.app/Contents/plugins/javascript-plugin/jsLanguageServicesImpl/external",
+ "ts.external.directory.path": "/Users/littlesheep/Documents/Projects/Hydrogen/Passport/web/node_modules/typescript/lib",
"vue.rearranger.settings.migration": "true"
},
"keyToStringList": {
@@ -143,7 +151,6 @@
-
@@ -168,7 +175,8 @@
-
+
+
true
diff --git a/pkg/internal/server/api/avatar_api.go b/pkg/internal/server/api/avatar_api.go
index 2b6bfc3..3bc27c1 100644
--- a/pkg/internal/server/api/avatar_api.go
+++ b/pkg/internal/server/api/avatar_api.go
@@ -19,10 +19,6 @@ func setAvatar(c *fiber.Ctx) error {
}
user := c.Locals("user").(models.Account)
- if err := exts.EnsureAuthenticated(c); err != nil {
- return err
- }
-
var data struct {
AttachmentID uint `json:"attachment" validate:"required"`
}
@@ -88,3 +84,29 @@ func setBanner(c *fiber.Ctx) error {
return c.SendStatus(fiber.StatusOK)
}
+
+func getAvatar(c *fiber.Ctx) error {
+ if err := exts.EnsureAuthenticated(c); err != nil {
+ return err
+ }
+ user := c.Locals("user").(models.Account)
+
+ if content := user.GetAvatar(); content == nil {
+ return c.SendStatus(fiber.StatusNotFound)
+ } else {
+ return c.Redirect(*content, fiber.StatusNotFound)
+ }
+}
+
+func getBanner(c *fiber.Ctx) error {
+ if err := exts.EnsureAuthenticated(c); err != nil {
+ return err
+ }
+ user := c.Locals("user").(models.Account)
+
+ if content := user.GetBanner(); content == nil {
+ return c.SendStatus(fiber.StatusNotFound)
+ } else {
+ return c.Redirect(*content, fiber.StatusNotFound)
+ }
+}
diff --git a/pkg/internal/server/api/index.go b/pkg/internal/server/api/index.go
index cb828b3..739e58e 100644
--- a/pkg/internal/server/api/index.go
+++ b/pkg/internal/server/api/index.go
@@ -22,6 +22,8 @@ func MapAPIs(app *fiber.App) {
me := api.Group("/users/me").Name("Myself Operations")
{
+ me.Get("/avatar", getAvatar)
+ me.Get("/banner", getBanner)
me.Put("/avatar", setAvatar)
me.Put("/banner", setBanner)
diff --git a/settings.toml b/settings.toml
index 6a9da1b..8e6d066 100644
--- a/settings.toml
+++ b/settings.toml
@@ -1,7 +1,7 @@
id = "passport01"
name = "Solarpass"
-frontend_app = "/passport/web"
+frontend_app = "web/dist"
bind = "0.0.0.0:8444"
grpc_bind = "0.0.0.0:7444"
diff --git a/web/.gitignore b/web/.gitignore
index 8ee54e8..3740343 100755
--- a/web/.gitignore
+++ b/web/.gitignore
@@ -28,3 +28,5 @@ coverage
*.sw?
*.tsbuildinfo
+
+.vite
\ No newline at end of file
diff --git a/web/.vite/deps/_metadata.json b/web/.vite/deps/_metadata.json
index 6d72a72..d806bde 100644
--- a/web/.vite/deps/_metadata.json
+++ b/web/.vite/deps/_metadata.json
@@ -1,8 +1,85 @@
{
- "hash": "47c7bee8",
+ "hash": "8b6d0833",
"configHash": "9db2f33b",
- "lockfileHash": "e3b0c442",
- "browserHash": "0938dccf",
- "optimized": {},
- "chunks": {}
+ "lockfileHash": "f7feab31",
+ "browserHash": "0decaeb8",
+ "optimized": {
+ "vue": {
+ "src": "../../node_modules/vue/dist/vue.runtime.esm-bundler.js",
+ "file": "vue.js",
+ "fileHash": "1913939b",
+ "needsInterop": false
+ },
+ "pinia": {
+ "src": "../../node_modules/pinia/dist/pinia.mjs",
+ "file": "pinia.js",
+ "fileHash": "4c101c90",
+ "needsInterop": false
+ },
+ "vuetify": {
+ "src": "../../node_modules/vuetify/lib/framework.mjs",
+ "file": "vuetify.js",
+ "fileHash": "3ab2542c",
+ "needsInterop": false
+ },
+ "vuetify/blueprints": {
+ "src": "../../node_modules/vuetify/lib/blueprints/index.mjs",
+ "file": "vuetify_blueprints.js",
+ "fileHash": "b34fe63c",
+ "needsInterop": false
+ },
+ "vuetify/components": {
+ "src": "../../node_modules/vuetify/lib/components/index.mjs",
+ "file": "vuetify_components.js",
+ "fileHash": "42f8a374",
+ "needsInterop": false
+ },
+ "vuetify/labs/components": {
+ "src": "../../node_modules/vuetify/lib/labs/components.mjs",
+ "file": "vuetify_labs_components.js",
+ "fileHash": "a46a672a",
+ "needsInterop": false
+ },
+ "vuetify/directives": {
+ "src": "../../node_modules/vuetify/lib/directives/index.mjs",
+ "file": "vuetify_directives.js",
+ "fileHash": "66c34130",
+ "needsInterop": false
+ },
+ "vue-router": {
+ "src": "../../node_modules/vue-router/dist/vue-router.mjs",
+ "file": "vue-router.js",
+ "fileHash": "56488480",
+ "needsInterop": false
+ }
+ },
+ "chunks": {
+ "chunk-WKTZ3I3B": {
+ "file": "chunk-WKTZ3I3B.js"
+ },
+ "chunk-XJKCW2PU": {
+ "file": "chunk-XJKCW2PU.js"
+ },
+ "chunk-VFMM6PD2": {
+ "file": "chunk-VFMM6PD2.js"
+ },
+ "chunk-XREPMAG4": {
+ "file": "chunk-XREPMAG4.js"
+ },
+ "chunk-ZUZRGUJJ": {
+ "file": "chunk-ZUZRGUJJ.js"
+ },
+ "chunk-V6X3YB3T": {
+ "file": "chunk-V6X3YB3T.js"
+ },
+ "chunk-6CN2GOSH": {
+ "file": "chunk-6CN2GOSH.js"
+ },
+ "chunk-AYVSL3LM": {
+ "file": "chunk-AYVSL3LM.js"
+ },
+ "chunk-Q5PGHB6G": {
+ "file": "chunk-Q5PGHB6G.js"
+ }
+ }
}
\ No newline at end of file
diff --git a/web/package.json b/web/package.json
index 098325b..886e629 100755
--- a/web/package.json
+++ b/web/package.json
@@ -14,12 +14,12 @@
"dependencies": {
"@fontsource/roboto": "^5.0.13",
"@mdi/font": "^7.4.47",
- "@unocss/reset": "^0.58.9",
+ "@unocss/reset": "^0.61.0",
"dompurify": "^3.1.5",
"marked": "^12.0.2",
"pinia": "^2.1.7",
"universal-cookie": "^7.1.4",
- "unocss": "^0.58.9",
+ "unocss": "^0.61.0",
"vue": "^3.4.30",
"vue-router": "^4.4.0",
"vuetify": "^3.6.10"
diff --git a/web/src/components/NotificationList.vue b/web/src/components/NotificationList.vue
index 2cc426c..b7415d2 100755
--- a/web/src/components/NotificationList.vue
+++ b/web/src/components/NotificationList.vue
@@ -10,7 +10,7 @@
subtitle="There is no more new things for you..." />
-
+
{{ item.subject }}
{{ item.content }}
diff --git a/web/src/views/dashboard.vue b/web/src/views/dashboard.vue
index 750e1c4..f86f4cd 100755
--- a/web/src/views/dashboard.vue
+++ b/web/src/views/dashboard.vue
@@ -1,15 +1,15 @@