Skip to content

Commit

Permalink
fix: skew protection
Browse files Browse the repository at this point in the history
  • Loading branch information
Innei committed Jul 15, 2023
1 parent 62d0923 commit 49cae51
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
7 changes: 6 additions & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ let nextConfig = {
experimental: {
appDir: true,
serverComponentsExternalPackages: ['shiki', 'vscode-oniguruma'],
serverActions: true,
serverMinification: true,

// @see https://vercel.com/blog/version-skew-protection
useDeploymentId: true,
// If use with serverActions is desired
serverActions: true,
useDeploymentIdServerActions: true,
},

images: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function CommentBoxSignedOutContent() {
setCommentMode(CommentBoxMode.legacy)
}}
>
转换到传统评论
免登录评论
</StyledButton>
<SignInButton mode="modal" redirectUrl={urlBuilder(pathname).href}>
<StyledButton variant="primary" type="button">
Expand Down
12 changes: 10 additions & 2 deletions src/constants/env.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
export const API_URL =
process.env.NEXT_PUBLIC_API_URL || process.env.NEXT_PUBLIC_APIURL || '/api/v2'
import { isClientSide, isDev } from '~/lib/env'

export const API_URL = (() => {
if (isDev) return process.env.NEXT_PUBLIC_API_URL

if (isClientSide && process.env.NEXT_PUBLIC_CHINA_API_URL) {
return process.env.NEXT_PUBLIC_CHINA_API_URL
}

return process.env.NEXT_PUBLIC_API_URL || '/api/v2'
})()
export const GATEWAY_URL = process.env.NEXT_PUBLIC_GATEWAY_URL || ''
5 changes: 0 additions & 5 deletions storybook/src/glob.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@ import type { FC, ReactNode } from 'react'
import type { DocumentComponent, DocumentPageMeta } from '../typings'

import { Markdown } from './components/Mardown'
import { GLOB_PATH } from 'config' assert { type: 'macro' }

// TODO find project root
const modulesPath2PromiseMapping = import.meta.glob(

'../../src/components/ui/*/index.demo.(tsx|mdx)',
// GLOB_PATH,
{},
)

console.log(GLOB_PATH, 'GLOB_PATH')

// const mdxPath2PromiseMapping = import.meta.glob('../../*/index.demo.mdx', {
// as: 'raw',
// })
Expand Down

0 comments on commit 49cae51

Please sign in to comment.