diff --git a/pkg/util/jwt.go b/pkg/util/jwt.go index d742b79..5c386bf 100644 --- a/pkg/util/jwt.go +++ b/pkg/util/jwt.go @@ -16,7 +16,7 @@ type UserClaims struct { } func GenerateToken(username, password string) (string, error) { - expHours := 1 * 24 * time.Hour + expHours := 2 * 24 * time.Hour //expHours := 1 * time.Minute SetClaims := UserClaims{ Username: username, diff --git a/web/src/components/ui/ClickableTruncate.vue b/web/src/components/ui/ClickableTruncate.vue index b42e68b..4e7d6a5 100644 --- a/web/src/components/ui/ClickableTruncate.vue +++ b/web/src/components/ui/ClickableTruncate.vue @@ -36,8 +36,26 @@ const linkedHtml = computed(() => { if (start > lastIndex) { html += escapeHtml(value.slice(lastIndex, start)) } - const escapedUrl = escapeHtml(url) - html += `${escapedUrl}` + // 处理结尾多余的标点,如 ) ] } . , ; : ! ? 等(不属于URL的一部分) + let trimmed = url + let suffix = '' + while (trimmed.length && /[)\]\}\.,;:!?,。;:、!?"'”’]$/.test(trimmed)) { + const ch = trimmed[trimmed.length - 1] + if (ch === ')') { + const opens = (trimmed.match(/\(/g) || []).length + const closes = (trimmed.match(/\)/g) || []).length + if (closes < opens) { + break + } + } + suffix = ch + suffix + trimmed = trimmed.slice(0, -1) + } + const escapedTrimmed = escapeHtml(trimmed) + html += `${escapedTrimmed}` + if (suffix) { + html += escapeHtml(suffix) + } lastIndex = start + url.length } if (value.length > lastIndex) {