rust parser working on local build. fix docker build
This commit is contained in:
@@ -14,6 +14,13 @@ interface Post {
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
// Runtime statistics for parser usage
|
||||
const parserStats = {
|
||||
rust: 0,
|
||||
typescript: 0,
|
||||
lastRustError: '',
|
||||
};
|
||||
|
||||
export default function PostPage({ params }: { params: { slug: string[] } }) {
|
||||
const [post, setPost] = useState<Post | null>(null);
|
||||
// Modal state for zoomed image
|
||||
@@ -648,6 +655,20 @@ export default function PostPage({ params }: { params: { slug: string[] } }) {
|
||||
const loadPost = async () => {
|
||||
try {
|
||||
const response = await fetch(`/api/posts/${encodeURIComponent(slugPath)}`);
|
||||
const parser = response.headers.get('X-Parser');
|
||||
const rustError = response.headers.get('X-Rust-Parser-Error');
|
||||
if (parser === 'rust') {
|
||||
parserStats.rust++;
|
||||
console.log('%c[Rust Parser] Used for this post.', 'color: green; font-weight: bold');
|
||||
} else {
|
||||
parserStats.typescript++;
|
||||
console.log('%c[TypeScript Parser] Used for this post.', 'color: orange; font-weight: bold');
|
||||
if (rustError) {
|
||||
parserStats.lastRustError = rustError;
|
||||
console.warn('[Rust Parser Error]', rustError);
|
||||
}
|
||||
}
|
||||
console.info('[Parser Stats]', parserStats);
|
||||
const data = await response.json();
|
||||
setPost(data);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user