mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-13 15:09:13 +00:00
fix: 修复 eslint 报错
This commit is contained in:
@@ -6,7 +6,7 @@ import algoliasearch from 'algoliasearch'
|
||||
* 生成全文索引
|
||||
* @param {*} allPages
|
||||
*/
|
||||
const generateAlgoliaSearch = async ({ allPages, force = false }) => {
|
||||
const generateAlgoliaSearch = ({ allPages, force = false }) => {
|
||||
allPages?.forEach(p => {
|
||||
// 判断这篇文章是否需要重新创建索引
|
||||
if (p && !p.password) {
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
import BLOG from '@/blog.config'
|
||||
|
||||
/**
|
||||
* 订阅邮件-服务端接口
|
||||
* @param {*} email
|
||||
* @returns
|
||||
*/
|
||||
export default function subscribeToMailchimpApi({ email, first_name = '', last_name = '' }) {
|
||||
* 订阅邮件-服务端接口
|
||||
* @param {*} email
|
||||
* @returns
|
||||
*/
|
||||
export default function subscribeToMailchimpApi({
|
||||
email,
|
||||
first_name = '',
|
||||
last_name = ''
|
||||
}) {
|
||||
const listId = BLOG.MAILCHIMP_LIST_ID // 替换为你的邮件列表 ID
|
||||
const apiKey = BLOG.MAILCHIMP_API_KEY // 替换为你的 API KEY
|
||||
if (!email || !listId || !apiKey) {
|
||||
return {}
|
||||
return Promise.resolve({})
|
||||
}
|
||||
const data = {
|
||||
email_address: email,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import fs from 'fs'
|
||||
|
||||
export async function generateRobotsTxt(props) {
|
||||
export function generateRobotsTxt(props) {
|
||||
const { siteInfo } = props
|
||||
const LINK = siteInfo?.link
|
||||
const content = `
|
||||
|
||||
@@ -5,7 +5,7 @@ import { siteConfig } from './config'
|
||||
* 生成站点地图
|
||||
* @param {*} param0
|
||||
*/
|
||||
export async function generateSitemapXml({ allPages, NOTION_CONFIG }) {
|
||||
export function generateSitemapXml({ allPages, NOTION_CONFIG }) {
|
||||
let link = siteConfig('LINK', BLOG.LINK, NOTION_CONFIG)
|
||||
// 确保链接不以斜杠结尾
|
||||
if (link && link.endsWith('/')) {
|
||||
|
||||
@@ -64,7 +64,7 @@ const noAuthMiddleware = async (req: NextRequest, ev: any) => {
|
||||
* 鉴权中间件
|
||||
*/
|
||||
const authMiddleware = process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
|
||||
? clerkMiddleware(async (auth, req) => {
|
||||
? clerkMiddleware((auth, req) => {
|
||||
const { userId } = auth()
|
||||
// 处理 /dashboard 路由的登录保护
|
||||
if (isTenantRoute(req)) {
|
||||
|
||||
@@ -117,7 +117,7 @@ const nextConfig = {
|
||||
// 默认将feed重定向至 /public/rss/feed.xml
|
||||
redirects: process.env.EXPORT
|
||||
? undefined
|
||||
: async () => {
|
||||
: () => {
|
||||
return [
|
||||
{
|
||||
source: '/feed',
|
||||
@@ -129,7 +129,7 @@ const nextConfig = {
|
||||
// 重写url
|
||||
rewrites: process.env.EXPORT
|
||||
? undefined
|
||||
: async () => {
|
||||
: () => {
|
||||
// 处理多语言重定向
|
||||
const langsRewrites = []
|
||||
if (BLOG.NOTION_PAGE_ID.indexOf(',') > 0) {
|
||||
@@ -176,7 +176,7 @@ const nextConfig = {
|
||||
},
|
||||
headers: process.env.EXPORT
|
||||
? undefined
|
||||
: async () => {
|
||||
: () => {
|
||||
return [
|
||||
{
|
||||
source: '/:path*{/}?',
|
||||
@@ -217,7 +217,7 @@ const nextConfig = {
|
||||
experimental: {
|
||||
scrollRestoration: true
|
||||
},
|
||||
exportPathMap: async function (
|
||||
exportPathMap: function (
|
||||
defaultPathMap,
|
||||
{ dev, dir, outDir, distDir, buildId }
|
||||
) {
|
||||
|
||||
@@ -62,7 +62,10 @@ export default async function handler(
|
||||
}
|
||||
|
||||
// 这里将用户数据写入到Notion数据库
|
||||
res.redirect(302, `/auth/result?${new URLSearchParams(redirectQuery)}`)
|
||||
res.redirect(
|
||||
302,
|
||||
`/auth/result?${new URLSearchParams(redirectQuery).toString()}`
|
||||
)
|
||||
} else {
|
||||
const redirectQuery = { msg: params?.statusText || '请求异常' }
|
||||
res.redirect(
|
||||
|
||||
@@ -71,7 +71,7 @@ export async function getStaticProps({ locale }) {
|
||||
}
|
||||
}
|
||||
|
||||
export const getStaticPaths = async () => {
|
||||
export const getStaticPaths = () => {
|
||||
return {
|
||||
paths: [
|
||||
{ params: { index: [] } }, // 对应首页路径
|
||||
|
||||
@@ -51,7 +51,7 @@ export async function getStaticProps({ params: { keyword }, locale }) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function getStaticPaths() {
|
||||
export function getStaticPaths() {
|
||||
return {
|
||||
paths: [{ params: { keyword: 'NotionNext' } }],
|
||||
fallback: true
|
||||
@@ -128,7 +128,7 @@ async function filterByMemCache(allPosts, keyword) {
|
||||
// console.log('全文搜索缓存', cacheKey, page != null)
|
||||
post.results = []
|
||||
let hitCount = 0
|
||||
for (const i in indexContent) {
|
||||
for (const i of indexContent) {
|
||||
const c = indexContent[i]
|
||||
if (!c) {
|
||||
continue
|
||||
|
||||
@@ -50,7 +50,7 @@ export async function getStaticProps({ params: { keyword, page }, locale }) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function getStaticPaths() {
|
||||
export function getStaticPaths() {
|
||||
return {
|
||||
paths: [{ params: { keyword: 'NotionNext', page: '1' } }],
|
||||
fallback: true
|
||||
@@ -135,7 +135,7 @@ async function filterByMemCache(allPosts, keyword) {
|
||||
// console.log('全文搜索缓存', cacheKey, page != null)
|
||||
post.results = []
|
||||
let hitCount = 0
|
||||
for (const i in indexContent) {
|
||||
for (const i of indexContent) {
|
||||
const c = indexContent[i]
|
||||
if (!c) {
|
||||
continue
|
||||
|
||||
@@ -37,7 +37,7 @@ export async function getStaticProps(req) {
|
||||
* catch-all route for clerk
|
||||
* @returns
|
||||
*/
|
||||
export async function getStaticPaths() {
|
||||
export function getStaticPaths() {
|
||||
return {
|
||||
paths: [
|
||||
{ params: { index: [] } }, // 使 /sign-in 路径可访问
|
||||
|
||||
@@ -36,7 +36,7 @@ export async function getStaticProps(req) {
|
||||
* catch-all route for clerk
|
||||
* @returns
|
||||
*/
|
||||
export async function getStaticPaths() {
|
||||
export function getStaticPaths() {
|
||||
return {
|
||||
paths: [
|
||||
{ params: { index: [] } }, // 使 /sign-up 路径可访问
|
||||
|
||||
Reference in New Issue
Block a user