diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 6cf3c06..06056de 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -2,7 +2,7 @@ name: release-nightly on: push: - branches: [ master ] + branches: [master] jobs: build-docker: diff --git a/pkg/services/realms.go b/pkg/services/realms.go index 5de70ff..2588f52 100644 --- a/pkg/services/realms.go +++ b/pkg/services/realms.go @@ -65,9 +65,10 @@ func NewRealm(user models.Account, name, description string, realmType int) (mod func ListRealmMember(realmId uint) ([]models.RealmMember, error) { var members []models.RealmMember - if err := database.C.Where(&models.RealmMember{ - RealmID: realmId, - }).Find(&members).Error; err != nil { + if err := database.C. + Where(&models.RealmMember{RealmID: realmId}). + Preload("Account"). + Find(&members).Error; err != nil { return members, err } diff --git a/pkg/views/.eslintrc.cjs b/pkg/views/.eslintrc.cjs index 642fd69..94744c3 100644 --- a/pkg/views/.eslintrc.cjs +++ b/pkg/views/.eslintrc.cjs @@ -1,19 +1,20 @@ /* eslint-env node */ -require('@rushstack/eslint-patch/modern-module-resolution') +require("@rushstack/eslint-patch/modern-module-resolution") module.exports = { root: true, - 'extends': [ - 'plugin:vue/vue3-essential', - 'eslint:recommended', - '@vue/eslint-config-typescript', - '@vue/eslint-config-prettier/skip-formatting' + extends: [ + "plugin:vue/vue3-essential", + "eslint:recommended", + "@vue/eslint-config-typescript", + "@vue/eslint-config-prettier/skip-formatting" ], parserOptions: { - ecmaVersion: 'latest' + ecmaVersion: "latest" }, rules: { - 'vue/multi-word-component-names': 'off', - 'vue/valid-v-for': 'off' + "vue/multi-word-component-names": "off", + "vue/valid-v-for": "off", + "vue/require-v-for-key": "off" } } diff --git a/pkg/views/README.md b/pkg/views/README.md index f25fd02..a164f21 100644 --- a/pkg/views/README.md +++ b/pkg/views/README.md @@ -13,8 +13,8 @@ TypeScript cannot handle type information for `.vue` imports by default, so we r If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps: 1. Disable the built-in TypeScript Extension - 1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette - 2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)` + 1. Run `Extensions: Show Built-in Extensions` from VSCode's command palette + 2. Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)` 2. Reload the VSCode window by running `Developer: Reload Window` from the command palette. ## Customize configuration diff --git a/pkg/views/index.html b/pkg/views/index.html index cf6b46c..87c2281 100644 --- a/pkg/views/index.html +++ b/pkg/views/index.html @@ -1,9 +1,9 @@ - + - - - + + + Solarplaza diff --git a/pkg/views/src/assets/utils.css b/pkg/views/src/assets/utils.css index f676730..840e4ee 100644 --- a/pkg/views/src/assets/utils.css +++ b/pkg/views/src/assets/utils.css @@ -1,12 +1,15 @@ -html, body, #app, .v-application { - overflow: auto !important; - font-family: "Roboto Sans", ui-sans-serif, system-ui, sans-serif; +html, +body, +#app, +.v-application { + overflow: auto !important; + font-family: "Roboto Sans", ui-sans-serif, system-ui, sans-serif; } .no-scrollbar { - scrollbar-width: none; + scrollbar-width: none; } .no-scrollbar::-webkit-scrollbar { - width: 0; + width: 0; } diff --git a/pkg/views/src/components/posts/CommentContent.vue b/pkg/views/src/components/posts/CommentContent.vue index c3714c4..47c1a76 100644 --- a/pkg/views/src/components/posts/CommentContent.vue +++ b/pkg/views/src/components/posts/CommentContent.vue @@ -3,13 +3,13 @@ diff --git a/pkg/views/src/components/posts/PostAction.vue b/pkg/views/src/components/posts/PostAction.vue index 3299a01..805ec6d 100644 --- a/pkg/views/src/components/posts/PostAction.vue +++ b/pkg/views/src/components/posts/PostAction.vue @@ -14,7 +14,7 @@ diff --git a/pkg/views/src/components/publish/ArticleEditor.vue b/pkg/views/src/components/publish/ArticleEditor.vue index 31cb352..3bf700c 100644 --- a/pkg/views/src/components/publish/ArticleEditor.vue +++ b/pkg/views/src/components/publish/ArticleEditor.vue @@ -25,18 +25,37 @@ You are editing a post with alias {{ editor.related.edit_to?.alias }} - + @@ -47,7 +66,8 @@

Your content will visible for public at

- {{ data.published_at ? new Date(data.published_at).toLocaleString() : new Date().toLocaleString() + {{ + data.published_at ? new Date(data.published_at).toLocaleString() : new Date().toLocaleString() }}

@@ -103,12 +123,12 @@ import { request } from "@/scripts/request" import { useEditor } from "@/stores/editor" import { getAtk } from "@/stores/userinfo" -import { useRealms } from "@/stores/realms"; -import { computed, reactive, ref, watch } from "vue"; +import { useRealms } from "@/stores/realms" +import { computed, reactive, ref, watch } from "vue" import { useRoute, useRouter } from "vue-router" import PlannedPublish from "@/components/publish/parts/PlannedPublish.vue" import Media from "@/components/publish/parts/Media.vue" -import PublishArea from "@/components/publish/parts/PublishArea.vue"; +import PublishArea from "@/components/publish/parts/PublishArea.vue" const route = useRoute() const realms = useRealms() @@ -118,7 +138,7 @@ const dialogs = reactive({ plan: false, categories: false, media: false, - area: false, + area: false }) const data = ref({ diff --git a/pkg/views/src/components/publish/MomentEditor.vue b/pkg/views/src/components/publish/MomentEditor.vue index a48f523..e6d180e 100644 --- a/pkg/views/src/components/publish/MomentEditor.vue +++ b/pkg/views/src/components/publish/MomentEditor.vue @@ -6,20 +6,40 @@ You are editing a post with alias {{ editor.related.edit_to?.alias }} - +
diff --git a/pkg/views/src/components/realms/RealmAction.vue b/pkg/views/src/components/realms/RealmAction.vue index 9c72ac5..314cd07 100644 --- a/pkg/views/src/components/realms/RealmAction.vue +++ b/pkg/views/src/components/realms/RealmAction.vue @@ -13,8 +13,8 @@ + + diff --git a/pkg/views/src/layouts/master.vue b/pkg/views/src/layouts/master.vue index 1549e85..41a3476 100644 --- a/pkg/views/src/layouts/master.vue +++ b/pkg/views/src/layouts/master.vue @@ -99,7 +99,7 @@ import { useUserinfo } from "@/stores/userinfo" import { useWellKnown } from "@/stores/wellKnown" import PostTools from "@/components/publish/PostTools.vue" import RealmTools from "@/components/realms/RealmTools.vue" -import RealmList from "@/components/realms/RealmList.vue"; +import RealmList from "@/components/realms/RealmList.vue" const id = useUserinfo() const editor = useEditor() diff --git a/pkg/views/src/main.ts b/pkg/views/src/main.ts index edb1660..233d23b 100644 --- a/pkg/views/src/main.ts +++ b/pkg/views/src/main.ts @@ -1,32 +1,32 @@ -import "virtual:uno.css"; +import "virtual:uno.css" -import "./assets/utils.css"; +import "./assets/utils.css" -import { createApp } from "vue"; -import { createPinia } from "pinia"; +import { createApp } from "vue" +import { createPinia } from "pinia" -import "vuetify/styles"; -import { createVuetify } from "vuetify"; -import { md3 } from "vuetify/blueprints"; -import * as components from "vuetify/components"; -import * as labsComponents from 'vuetify/labs/components' -import * as directives from "vuetify/directives"; +import "vuetify/styles" +import { createVuetify } from "vuetify" +import { md3 } from "vuetify/blueprints" +import * as components from "vuetify/components" +import * as labsComponents from "vuetify/labs/components" +import * as directives from "vuetify/directives" -import "@mdi/font/css/materialdesignicons.min.css"; -import "@fontsource/roboto/latin.css"; -import "@unocss/reset/tailwind.css"; +import "@mdi/font/css/materialdesignicons.min.css" +import "@fontsource/roboto/latin.css" +import "@unocss/reset/tailwind.css" -import index from "./index.vue"; -import router from "./router"; +import index from "./index.vue" +import router from "./router" -const app = createApp(index); +const app = createApp(index) app.use( createVuetify({ directives, components: { ...components, - ...labsComponents, + ...labsComponents }, blueprint: md3, theme: { @@ -46,9 +46,9 @@ app.use( } } }) -); +) -app.use(createPinia()); -app.use(router); +app.use(createPinia()) +app.use(router) -app.mount("#app"); +app.mount("#app") diff --git a/pkg/views/src/router/index.ts b/pkg/views/src/router/index.ts index 5ddd36c..3ce9642 100644 --- a/pkg/views/src/router/index.ts +++ b/pkg/views/src/router/index.ts @@ -1,5 +1,5 @@ -import { createRouter, createWebHistory } from "vue-router"; -import MasterLayout from "@/layouts/master.vue"; +import { createRouter, createWebHistory } from "vue-router" +import MasterLayout from "@/layouts/master.vue" const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), @@ -14,7 +14,6 @@ const router = createRouter({ component: () => import("@/views/explore.vue") }, - { path: "/p/moments/:alias", name: "posts.details.moments", @@ -34,6 +33,6 @@ const router = createRouter({ ] } ] -}); +}) -export default router; +export default router diff --git a/pkg/views/src/stores/realms.ts b/pkg/views/src/stores/realms.ts index fa33f4a..9140618 100644 --- a/pkg/views/src/stores/realms.ts +++ b/pkg/views/src/stores/realms.ts @@ -1,6 +1,7 @@ import { reactive, ref } from "vue" import { defineStore } from "pinia" import { checkLoggedIn, getAtk } from "@/stores/userinfo" +import { request } from "@/scripts/request" export const useRealms = defineStore("realms", () => { const done = ref(false) @@ -20,7 +21,7 @@ export const useRealms = defineStore("realms", () => { async function list() { if (!checkLoggedIn()) return - const res = await fetch("/api/realms/me/available", { + const res = await request("/api/realms/me/available", { headers: { Authorization: `Bearer ${getAtk()}` } }) if (res.status !== 200) { diff --git a/pkg/views/src/stores/userinfo.ts b/pkg/views/src/stores/userinfo.ts index 2f4f1a8..386a857 100644 --- a/pkg/views/src/stores/userinfo.ts +++ b/pkg/views/src/stores/userinfo.ts @@ -31,25 +31,25 @@ export const useUserinfo = defineStore("userinfo", () => { async function readProfiles() { if (!checkLoggedIn()) { - isReady.value = true; - } - - const res = await request("/api/users/me", { - headers: { "Authorization": `Bearer ${getAtk()}` } - }); - - if (res.status !== 200) { - return; - } - - const data = await res.json(); - - userinfo.value = { - isReady: true, - isLoggedIn: true, - displayName: data["nick"], - data: data - }; + isReady.value = true + } + + const res = await request("/api/users/me", { + headers: { Authorization: `Bearer ${getAtk()}` } + }) + + if (res.status !== 200) { + return + } + + const data = await res.json() + + userinfo.value = { + isReady: true, + isLoggedIn: true, + displayName: data["nick"], + data: data + } } return { userinfo, isReady, readProfiles } diff --git a/pkg/views/src/views/explore.vue b/pkg/views/src/views/explore.vue index 43fe874..f2e3486 100644 --- a/pkg/views/src/views/explore.vue +++ b/pkg/views/src/views/explore.vue @@ -15,46 +15,49 @@ diff --git a/pkg/views/src/views/realms/page.vue b/pkg/views/src/views/realms/page.vue index d4bfa62..cf6a38e 100644 --- a/pkg/views/src/views/realms/page.vue +++ b/pkg/views/src/views/realms/page.vue @@ -5,7 +5,7 @@
- + + + + +
@@ -36,6 +40,7 @@ import { parse } from "marked" import dompurify from "dompurify" import PostList from "@/components/posts/PostList.vue" import RealmAction from "@/components/realms/RealmAction.vue" +import RealmMembers from "@/components/realms/RealmMembers.vue" const route = useRoute() const realms = useRealms() diff --git a/pkg/views/tsconfig.node.json b/pkg/views/tsconfig.node.json index f094063..2c669ee 100644 --- a/pkg/views/tsconfig.node.json +++ b/pkg/views/tsconfig.node.json @@ -1,12 +1,6 @@ { "extends": "@tsconfig/node20/tsconfig.json", - "include": [ - "vite.config.*", - "vitest.config.*", - "cypress.config.*", - "nightwatch.conf.*", - "playwright.config.*" - ], + "include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "nightwatch.conf.*", "playwright.config.*"], "compilerOptions": { "composite": true, "noEmit": true, diff --git a/pkg/views/uno.config.ts b/pkg/views/uno.config.ts index cb688df..d0bf10d 100644 --- a/pkg/views/uno.config.ts +++ b/pkg/views/uno.config.ts @@ -1,4 +1,4 @@ -import { defineConfig, presetAttributify, presetTypography, presetUno } from "unocss"; +import { defineConfig, presetAttributify, presetTypography, presetUno } from "unocss" export default defineConfig({ presets: [presetAttributify(), presetTypography(), presetUno({ preflight: false })]