-
Notifications
You must be signed in to change notification settings - Fork 421
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
497434b
commit 102f360
Showing
4 changed files
with
18 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { washMarkdownContent } from "../components/MarkdownTocBar/tools"; | ||
|
||
export function hasToc(content: string) { | ||
const r = /#+\s+/; | ||
return r.test(washMarkdownContent(content)); | ||
} | ||
const HASH_REG = /#+\s+/; | ||
|
||
export const hasToc = (content: string) => | ||
HASH_REG.test(washMarkdownContent(content)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
export const isIp = (str: string) => { | ||
const re = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/; | ||
return re.test(str); | ||
}; | ||
const IP_REGEXP = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/; | ||
|
||
export const isIp = (maybeIP: string): boolean => IP_REGEXP.test(maybeIP); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
const normalizeURL = (url: string) => new URL(url).toString(); | ||
|
||
// 从环境变量中读取. | ||
export const config = { | ||
baseUrl: washUrl(process.env.VAN_BLOG_SERVER_URL ?? "http://localhost:3000"), | ||
baseUrl: normalizeURL( | ||
process.env.VAN_BLOG_SERVER_URL ?? "http://localhost:3000" | ||
), | ||
}; | ||
|
||
function washUrl(url: string) { | ||
// 带反斜杠的 | ||
const u = new URL(url); | ||
return u.toString(); | ||
} | ||
|
||
// 改为服务端触发 isr | ||
// export const revalidate = {}; | ||
export const revalidate = process.env.VAN_BLOG_REVALIDATE == 'true' | ||
? { revalidate: parseInt(process.env.VAN_BLOG_REVALIDATE_TIME || "10") } | ||
: {}; | ||
export const revalidate = | ||
process.env.VAN_BLOG_REVALIDATE == "true" | ||
? { revalidate: parseInt(process.env.VAN_BLOG_REVALIDATE_TIME || "10") } | ||
: {}; |