Skip to content

Commit

Permalink
fix: bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
syfxlin committed Oct 3, 2023
1 parent f00db1c commit 2a8be57
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ unla apache

Scoop 中安装的 PHP 中会包含一个 cli 文件夹,该文件夹是持久化的,也就是说升级了 PHP 版本后不需要再重新配置 ini 文件, cli 中的 php.ini 和 conf.d 的 custom ini 会覆盖 PHP 根目录下的 ini 文件,同时若直接用 Scoop 安装插件,如 xdebug ,则会和 Linux 中了 PHP 读取配置的方式类似,利用模块化的 custom ini 载入配置。而 Laragon 默认不是采用模块化的 ini 加载的,会导致 Laragon 不能使用 Scoop 安装的 xdebug 。那么如何让 Laragon 也使用模块化加载 ini 文件呢?其实很简单,只需要修改 `LARAGON\etc\apache2\fcgid.conf` 文件即可,在 `#Location php.ini:` 下添加以下配置,然后重启 apache 即可

```apacheconf
```apache
FcgidInitialEnv PHP_INI_SCAN_DIR "C:\Users\<you username>\scoop\apps\php-nts\current\cli;C:\Users\<you username>\scoop\apps\php-nts\current\cli\conf.d;"
```
2 changes: 1 addition & 1 deletion src/adapters/scraper-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type ScraperResponse = {
thumbnail?: string;
};

const scraper = React.cache((link: string) => ogs({ url: link }));
const scraper = React.cache(async (link: string) => ogs({ url: link }));

export class ScraperAdapter extends Adapter<ScraperRequest, ScraperResponse> {
async valid(params: ScraperRequest): Promise<boolean> {
Expand Down
16 changes: 8 additions & 8 deletions src/app/(group)/archive/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ type Props = {
};
};

const query = async ({ params }: Props) => {
const query = React.cache(async (_slug: string, _index?: string) => {
try {
const query = await fetcher.archives();
const slug = slugger(decodeURIComponent(params.slug));
const index = params.index ? parseInt(params.index) : 1;
const slug = slugger(decodeURIComponent(_slug));
const index = _index ? parseInt(_index) : 1;
const value = query.pages.find((i) => i.slug === slug);
if (!value || value.pages < index) {
return undefined;
Expand All @@ -32,10 +32,10 @@ const query = async ({ params }: Props) => {
} catch (e) {
return undefined;
}
};
});

export const generateMetadata = async (props: Props): Promise<Metadata> => {
const data = await query(props);
export const generateMetadata = async ({ params }: Props): Promise<Metadata> => {
const data = await query(params.slug, params.index);
if (!data) {
return notFound();
}
Expand All @@ -49,8 +49,8 @@ export const generateMetadata = async (props: Props): Promise<Metadata> => {
});
};

export default async function ArchivePage(props: Props) {
const data = await query(props);
export default async function ArchivePage({ params }: Props) {
const data = await query(params.slug, params.index);
if (!data) {
return notFound();
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/(group)/archives/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Heading } from "../../../components/docs/heading";
import { List } from "../../../components/docs/list";
import { notFound } from "next/navigation";

const query = async () => {
const query = React.cache(async () => {
const [posts, archives, categories, tags] = await Promise.all([
fetcher.posts(),
fetcher.archives(),
Expand Down Expand Up @@ -40,7 +40,7 @@ const query = async () => {
count: i.items.length,
})),
};
};
});

export const generateMetadata = async (): Promise<Metadata> => {
const data = await query();
Expand Down
16 changes: 8 additions & 8 deletions src/app/(group)/category/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ type Props = {
};
};

const query = async ({ params }: Props) => {
const query = React.cache(async (_slug: string, _index?: string) => {
try {
const query = await fetcher.categories();
const slug = slugger(params.slug);
const index = params.index ? parseInt(params.index) : 1;
const slug = slugger(_slug);
const index = _index ? parseInt(_index) : 1;
const value = query.pages.find((i) => i.slug === slug);
if (!value || value.pages < index) {
return undefined;
Expand All @@ -32,10 +32,10 @@ const query = async ({ params }: Props) => {
} catch (e) {
return undefined;
}
};
});

export const generateMetadata = async (props: Props): Promise<Metadata> => {
const data = await query(props);
export const generateMetadata = async ({ params }: Props): Promise<Metadata> => {
const data = await query(params.slug, params.index);
if (!data) {
return notFound();
}
Expand All @@ -49,8 +49,8 @@ export const generateMetadata = async (props: Props): Promise<Metadata> => {
});
};

export default async function CategoryPage(props: Props) {
const data = await query(props);
export default async function CategoryPage({ params }: Props) {
const data = await query(params.slug, params.index);
if (!data) {
return notFound();
}
Expand Down
16 changes: 8 additions & 8 deletions src/app/(group)/tag/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ type Props = {
};
};

const query = async ({ params }: Props) => {
const query = React.cache(async (_slug: string, _index?: string) => {
try {
const query = await fetcher.tags();
const slug = slugger(params.slug);
const index = params.index ? parseInt(params.index) : 1;
const slug = slugger(_slug);
const index = _index ? parseInt(_index) : 1;
const value = query.pages.find((i) => i.slug === slug);
if (!value || value.pages < index) {
return undefined;
Expand All @@ -32,10 +32,10 @@ const query = async ({ params }: Props) => {
} catch (e) {
return undefined;
}
};
});

export const generateMetadata = async (props: Props): Promise<Metadata> => {
const data = await query(props);
export const generateMetadata = async ({ params }: Props): Promise<Metadata> => {
const data = await query(params.slug, params.index);
if (!data) {
return notFound();
}
Expand All @@ -49,8 +49,8 @@ export const generateMetadata = async (props: Props): Promise<Metadata> => {
});
};

export default async function TagPage(props: Props) {
const data = await query(props);
export default async function TagPage({ params }: Props) {
const data = await query(params.slug, params.index);
if (!data) {
return notFound();
}
Expand Down
16 changes: 8 additions & 8 deletions src/app/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ type Props = {
};
};

const query = async ({ params }: Props): Promise<TemplateArticlesProps | undefined> => {
const query = React.cache(async (_index?: string): Promise<TemplateArticlesProps | undefined> => {
try {
const home = await fetcher.home();
if (home.display === "document" && !params?.index) {
if (home.display === "document" && !_index) {
return {
display: "document",
document: home.content,
};
} else {
const query = await fetcher.posts();
const index = params?.index ? parseInt(params.index) : 1;
const index = _index ? parseInt(_index) : 1;
const value = query.pages;
if (!value || value.pages < index) {
return undefined;
Expand All @@ -38,18 +38,18 @@ const query = async ({ params }: Props): Promise<TemplateArticlesProps | undefin
} catch (e) {
return undefined;
}
};
});

export const generateMetadata = async (props: Props): Promise<Metadata> => {
const data = await query(props);
export const generateMetadata = async ({ params }: Props): Promise<Metadata> => {
const data = await query(params?.index);
if (!data) {
return notFound();
}
return metadataArticles(data);
};

export default async function ArticlesPage(props: Props) {
const data = await query(props);
export default async function ArticlesPage({ params }: Props) {
const data = await query(params?.index);
if (!data) {
return notFound();
}
Expand Down
14 changes: 7 additions & 7 deletions src/app/(page)/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ type Props = {
};
};

const query = async ({ params }: Props) => {
const query = React.cache(async (_slug: string) => {
try {
const query = await fetcher.pages();
const slug = decodeURIComponent(params.slug).toLowerCase();
const slug = decodeURIComponent(_slug).toLowerCase();
const value = query.items.find((i) => i.slug === slug);
if (!value) {
return undefined;
Expand All @@ -22,18 +22,18 @@ const query = async ({ params }: Props) => {
} catch (e) {
return undefined;
}
};
});

export const generateMetadata = async (props: Props): Promise<Metadata> => {
const data = await query(props);
export const generateMetadata = async ({ params }: Props): Promise<Metadata> => {
const data = await query(params.slug);
if (!data) {
return notFound();
}
return metadataPage({ data });
};

export default async function Page(props: Props) {
const data = await query(props);
export default async function Page({ params }: Props) {
const data = await query(params.slug);
if (!data) {
return notFound();
}
Expand Down
14 changes: 7 additions & 7 deletions src/app/(post)/post/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ type Props = {
};
};

const query = async ({ params }: Props) => {
const query = React.cache(async (_slug: string) => {
try {
const query = await fetcher.posts();
const slug = decodeURIComponent(params.slug).toLowerCase();
const slug = decodeURIComponent(_slug).toLowerCase();
for (let i = 0; i < query.items.length; i++) {
const prev = query.items[i - 1];
const curr = query.items[i];
Expand All @@ -40,18 +40,18 @@ const query = async ({ params }: Props) => {
} catch (e) {
return undefined;
}
};
});

export const generateMetadata = async (props: Props): Promise<Metadata> => {
const data = await query(props);
export const generateMetadata = async ({ params }: Props): Promise<Metadata> => {
const data = await query(params.slug);
if (!data) {
return notFound();
}
return metadataPage(data);
};

export default async function Page(props: Props) {
const data = await query(props);
export default async function Page({ params }: Props) {
const data = await query(params.slug);
if (!data) {
return notFound();
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/widgets/projects/styles.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ export const github = styled.css`
white-space: nowrap;
svg {
margin-top: ${theme.fontSize.calc(0.1)};
width: ${theme.fontSize.calc(0.9)};
height: ${theme.fontSize.calc(0.9)};
margin-top: ${theme.fontSize.calc(0.1)} !important;
width: ${theme.fontSize.calc(0.9)} !important;
height: ${theme.fontSize.calc(0.9)} !important;
}
`;

0 comments on commit 2a8be57

Please sign in to comment.