Skip to content

Commit 7b66578

Browse files
committed
chore(deps): update various dependencies
1 parent 34fef1f commit 7b66578

26 files changed

Lines changed: 633 additions & 489 deletions

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ jobs:
138138
- name: Set up Go
139139
uses: actions/setup-go@v6
140140
with:
141-
go-version: ^1.26.0
141+
go-version: ^1.26.1
142142
cache: false
143143

144144
- name: Setup environment
@@ -313,7 +313,7 @@ jobs:
313313
- name: Set up Go
314314
uses: actions/setup-go@v6
315315
with:
316-
go-version: ^1.26.0
316+
go-version: ^1.26.1
317317
cache: false
318318

319319
- name: Setup environment
@@ -450,7 +450,7 @@ jobs:
450450
- name: Set up Go
451451
uses: actions/setup-go@v6
452452
with:
453-
go-version: ^1.26.0
453+
go-version: ^1.26.1
454454
cache: false
455455

456456
- name: Setup environment

api/user/current_user.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"net/http"
55

66
"github.com/0xJacky/Nginx-UI/api"
7+
internalUser "github.com/0xJacky/Nginx-UI/internal/user"
78
"github.com/0xJacky/Nginx-UI/model"
89
"github.com/gin-gonic/gin"
910
"github.com/uozi-tech/cosy"
@@ -33,6 +34,7 @@ func UpdateCurrentUser(c *gin.Context) {
3334
return
3435
}
3536

37+
internalUser.InvalidateUserCache(user.ID)
3638
c.JSON(http.StatusOK, user)
3739
})
3840
}
@@ -70,6 +72,7 @@ func UpdateCurrentUserPassword(c *gin.Context) {
7072
return
7173
}
7274

75+
internalUser.DeleteUserTokens(user.ID)
7376
c.JSON(http.StatusOK, gin.H{
7477
"message": "ok",
7578
})
@@ -96,6 +99,7 @@ func UpdateCurrentUserLanguage(c *gin.Context) {
9699
return
97100
}
98101

102+
internalUser.InvalidateUserCache(user.ID)
99103
c.JSON(http.StatusOK, gin.H{
100104
"language": json.Language,
101105
})

api/user/user.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package user
33
import (
44
"github.com/0xJacky/Nginx-UI/internal/user"
55
"github.com/0xJacky/Nginx-UI/model"
6-
"github.com/0xJacky/Nginx-UI/query"
76
"github.com/0xJacky/Nginx-UI/settings"
87
"github.com/gin-gonic/gin"
8+
"github.com/spf13/cast"
99
"github.com/uozi-tech/cosy"
1010
"golang.org/x/crypto/bcrypt"
1111
)
@@ -43,9 +43,15 @@ func InitManageUserRouter(g *gin.RouterGroup) {
4343
})
4444
c.BeforeDecodeHook(encryptPassword)
4545
c.ExecutedHook(func(ctx *cosy.Ctx[model.User]) {
46-
if ctx.Payload["password"] != "" {
47-
a := query.AuthToken
48-
_, _ = a.Where(a.UserID.Eq(ctx.ID)).Delete()
46+
user.InvalidateUserCache(ctx.ID)
47+
48+
if ctx.Payload["password"] != nil {
49+
user.DeleteUserTokens(ctx.ID)
50+
return
51+
}
52+
53+
if status, ok := ctx.Payload["status"]; ok && !cast.ToBool(status) {
54+
user.DeleteUserTokens(ctx.ID)
4955
}
5056
})
5157
})

app/eslint.config.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import autoImport from './.eslint-auto-import.mjs'
55
export default createConfig(
66
{
77
stylistic: true,
8-
ignores: ['**/version.json', 'tsconfig.json', 'tsconfig.node.json', '.eslint-auto-import.mjs', '**/china.json', '**/world.json'],
8+
ignores: ['**/*.md', '**/version.json', 'tsconfig.json', 'tsconfig.node.json', '.eslint-auto-import.mjs', '**/china.json', '**/world.json'],
9+
plugins: {
10+
sonarjs,
11+
},
912
languageOptions: {
1013
globals: {
1114
...autoImport.globals,
@@ -15,7 +18,6 @@ export default createConfig(
1518
},
1619
},
1720
},
18-
sonarjs.configs.recommended,
1921
{
2022
name: '@nginx-ui/eslint-config',
2123
rules: {
@@ -65,6 +67,8 @@ export default createConfig(
6567
'sonarjs/no-nested-template-literals': 'off',
6668
'sonarjs/pseudo-random': 'warn',
6769
'sonarjs/no-nested-functions': 'off',
70+
'sonarjs/unused-import': 'off',
71+
'e18e/prefer-static-regex': 'off',
6872

6973
'eslint-comments/no-unlimited-disable': 'off',
7074

app/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nginx-ui-app-next",
33
"type": "module",
44
"version": "2.3.3",
5-
"packageManager": "pnpm@10.30.0+sha512.2b5753de015d480eeb88f5b5b61e0051f05b4301808a82ec8b840c9d2adf7748eb352c83f5c1593ca703ff1017295bc3fdd3119abb9686efc96b9fcb18200937",
5+
"packageManager": "pnpm@10.32.1",
66
"scripts": {
77
"dev": "vite --host",
88
"typecheck": "vue-tsc --noEmit",
@@ -75,19 +75,18 @@
7575
"@vitejs/plugin-vue": "^6.0.5",
7676
"@vitejs/plugin-vue-jsx": "^5.1.5",
7777
"@vue/compiler-sfc": "^3.5.30",
78-
"@vue/tsconfig": "^0.8.1",
78+
"@vue/tsconfig": "^0.9.0",
7979
"ace-builds": "^1.43.6",
8080
"autoprefixer": "^10.4.27",
8181
"eslint": "^10.0.3",
82-
"eslint-plugin-sonarjs": "^3.0.7",
82+
"eslint-plugin-sonarjs": "^4.0.2",
8383
"less": "^4.6.4",
8484
"postcss": "^8.5.8",
8585
"typescript": "5.9.3",
8686
"unplugin-auto-import": "^21.0.0",
8787
"unplugin-vue-components": "^31.0.0",
8888
"unplugin-vue-define-options": "^3.1.2",
89-
"vite": "^7.3.1",
90-
"vite-plugin-inspect": "^11.3.3",
89+
"vite": "^8.0.0",
9190
"vite-svg-loader": "^5.1.1",
9291
"vue-tsc": "^3.2.5"
9392
}

app/src/components/Chart/AreaChart.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script setup lang="ts">
2+
import type { ApexOptions } from 'apexcharts'
23
import type { Ref } from 'vue'
34
import type { Series } from '@/components/Chart/types'
45
import { storeToRefs } from 'pinia'
@@ -20,7 +21,7 @@ function fontColor() {
2021
2122
const chart: Ref<ApexCharts | undefined> = ref()
2223
23-
let chartOptions = {
24+
let chartOptions: ApexOptions = {
2425
chart: {
2526
type: 'area',
2627
zoom: {

app/src/components/CodeEditor/CodeCompletion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ function useCodeCompletion() {
159159
}
160160

161161
function checkWordBoundary(beforeCursor: string, afterCursor: string): boolean {
162-
if (afterCursor.match(/^\w/) && !beforeCursor.endsWith('{')) {
162+
if (/^\w/.test(afterCursor) && !beforeCursor.endsWith('{')) {
163163
debug('Skipping completion: cursor in middle of word')
164164
return false
165165
}

app/src/components/ConfigHistory/DiffViewer.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ function setContent() {
5858
}
5959
else if (props.records.length === 2) {
6060
// Compare two records - sort by time
61-
const sorted = [...props.records].sort((a, b) =>
62-
new Date(a.created_at).getTime() - new Date(b.created_at).getTime(),
63-
)
61+
const sorted = props.records.toSorted((a, b) =>
62+
new Date(a.created_at).getTime() - new Date(b.created_at).getTime())
6463
originalText.value = sorted[0]?.content || ''
6564
modifiedText.value = sorted[1]?.content || ''
6665
originalTitle.value = `${sorted[0]?.name || ''} (${formatDateTime(sorted[0]?.created_at || '')})`

app/src/components/LLM/llm.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export const useLLMStore = defineStore('llm', () => {
117117

118118
// Update the last assistant message content (for streaming)
119119
function updateLastAssistantMessage(content: string) {
120-
const lastMessage = messages.value[messages.value.length - 1]
120+
const lastMessage = messages.value.at(-1)
121121
if (lastMessage && lastMessage.role === 'assistant') {
122122
lastMessage.content = content
123123
}
@@ -374,7 +374,8 @@ export const useLLMStore = defineStore('llm', () => {
374374
catch (error) {
375375
console.error('Chat request failed:', error)
376376
// Remove the empty assistant message on error
377-
if (messages.value.length > 0 && messages.value[messages.value.length - 1].content === '') {
377+
const lastMessage = messages.value.at(-1)
378+
if (lastMessage?.content === '') {
378379
messages.value.pop()
379380
}
380381
}

app/src/components/LLM/sessionStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const useLLMSessionStore = defineStore('llm-session', () => {
1818
})
1919

2020
const sortedSessions = computed(() => {
21-
return [...sessions.value].sort((a, b) => {
21+
return sessions.value.toSorted((a, b) => {
2222
return new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime()
2323
})
2424
})

0 commit comments

Comments
 (0)