Blog seite Fiexed
This commit is contained in:
parent
4721b59b10
commit
9dfb001fc9
@ -12,11 +12,6 @@
|
|||||||
],
|
],
|
||||||
"rootMainFiles": [],
|
"rootMainFiles": [],
|
||||||
"pages": {
|
"pages": {
|
||||||
"/": [
|
|
||||||
"static/chunks/webpack.js",
|
|
||||||
"static/chunks/main.js",
|
|
||||||
"static/chunks/pages/index.js"
|
|
||||||
],
|
|
||||||
"/_app": [
|
"/_app": [
|
||||||
"static/chunks/webpack.js",
|
"static/chunks/webpack.js",
|
||||||
"static/chunks/main.js",
|
"static/chunks/main.js",
|
||||||
@ -26,6 +21,16 @@
|
|||||||
"static/chunks/webpack.js",
|
"static/chunks/webpack.js",
|
||||||
"static/chunks/main.js",
|
"static/chunks/main.js",
|
||||||
"static/chunks/pages/_error.js"
|
"static/chunks/pages/_error.js"
|
||||||
|
],
|
||||||
|
"/admin": [
|
||||||
|
"static/chunks/webpack.js",
|
||||||
|
"static/chunks/main.js",
|
||||||
|
"static/chunks/pages/admin.js"
|
||||||
|
],
|
||||||
|
"/admin/blog": [
|
||||||
|
"static/chunks/webpack.js",
|
||||||
|
"static/chunks/main.js",
|
||||||
|
"static/chunks/pages/admin/blog.js"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ampFirstPages": []
|
"ampFirstPages": []
|
||||||
|
|||||||
BIN
.next/cache/webpack/client-development/0.pack.gz
vendored
BIN
.next/cache/webpack/client-development/0.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/client-development/1.pack.gz
vendored
BIN
.next/cache/webpack/client-development/1.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/client-development/2.pack.gz
vendored
BIN
.next/cache/webpack/client-development/2.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/client-development/3.pack.gz
vendored
BIN
.next/cache/webpack/client-development/3.pack.gz
vendored
Binary file not shown.
Binary file not shown.
BIN
.next/cache/webpack/server-development/0.pack.gz
vendored
BIN
.next/cache/webpack/server-development/0.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/server-development/1.pack.gz
vendored
BIN
.next/cache/webpack/server-development/1.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/server-development/2.pack.gz
vendored
BIN
.next/cache/webpack/server-development/2.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/server-development/3.pack.gz
vendored
BIN
.next/cache/webpack/server-development/3.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/server-development/4.pack.gz
vendored
BIN
.next/cache/webpack/server-development/4.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/server-development/5.pack.gz
vendored
BIN
.next/cache/webpack/server-development/5.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/server-development/index.pack.gz
vendored
BIN
.next/cache/webpack/server-development/index.pack.gz
vendored
Binary file not shown.
Binary file not shown.
@ -1 +1,18 @@
|
|||||||
{}
|
{
|
||||||
|
"..\\node_modules\\@supabase\\auth-js\\dist\\module\\lib\\helpers.js -> @supabase/node-fetch": {
|
||||||
|
"id": "..\\node_modules\\@supabase\\auth-js\\dist\\module\\lib\\helpers.js -> @supabase/node-fetch",
|
||||||
|
"files": []
|
||||||
|
},
|
||||||
|
"..\\node_modules\\@supabase\\functions-js\\dist\\module\\helper.js -> @supabase/node-fetch": {
|
||||||
|
"id": "..\\node_modules\\@supabase\\functions-js\\dist\\module\\helper.js -> @supabase/node-fetch",
|
||||||
|
"files": []
|
||||||
|
},
|
||||||
|
"..\\node_modules\\@supabase\\realtime-js\\dist\\module\\RealtimeClient.js -> @supabase/node-fetch": {
|
||||||
|
"id": "..\\node_modules\\@supabase\\realtime-js\\dist\\module\\RealtimeClient.js -> @supabase/node-fetch",
|
||||||
|
"files": []
|
||||||
|
},
|
||||||
|
"..\\node_modules\\@supabase\\storage-js\\dist\\module\\lib\\helpers.js -> @supabase/node-fetch": {
|
||||||
|
"id": "..\\node_modules\\@supabase\\storage-js\\dist\\module\\lib\\helpers.js -> @supabase/node-fetch",
|
||||||
|
"files": []
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1 +1 @@
|
|||||||
self.__BUILD_MANIFEST={"polyfillFiles":["static/chunks/polyfills.js"],"devFiles":["static/chunks/react-refresh.js"],"ampDevFiles":[],"lowPriorityFiles":["static/development/_buildManifest.js","static/development/_ssgManifest.js"],"rootMainFiles":[],"pages":{"/":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/index.js"],"/_app":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/_app.js"],"/_error":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/_error.js"]},"ampFirstPages":[]}
|
self.__BUILD_MANIFEST={"polyfillFiles":["static/chunks/polyfills.js"],"devFiles":["static/chunks/react-refresh.js"],"ampDevFiles":[],"lowPriorityFiles":["static/development/_buildManifest.js","static/development/_ssgManifest.js"],"rootMainFiles":[],"pages":{"/_app":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/_app.js"],"/_error":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/_error.js"],"/admin":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/admin.js"],"/admin/blog":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/admin/blog.js"]},"ampFirstPages":[]}
|
||||||
@ -1,6 +1,25 @@
|
|||||||
{
|
{
|
||||||
"sortedMiddleware": [],
|
"sortedMiddleware": [
|
||||||
"middleware": {},
|
"/"
|
||||||
|
],
|
||||||
|
"middleware": {
|
||||||
|
"/": {
|
||||||
|
"files": [
|
||||||
|
"server/edge-runtime-webpack.js",
|
||||||
|
"server/middleware.js"
|
||||||
|
],
|
||||||
|
"name": "middleware",
|
||||||
|
"page": "/",
|
||||||
|
"matchers": [
|
||||||
|
{
|
||||||
|
"regexp": "^/.*$",
|
||||||
|
"originalSource": "/:path*"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"wasm": [],
|
||||||
|
"assets": []
|
||||||
|
}
|
||||||
|
},
|
||||||
"functions": {},
|
"functions": {},
|
||||||
"version": 2
|
"version": 2
|
||||||
}
|
}
|
||||||
@ -1 +1 @@
|
|||||||
self.__REACT_LOADABLE_MANIFEST="{}"
|
self.__REACT_LOADABLE_MANIFEST="{\"..\\\\node_modules\\\\@supabase\\\\auth-js\\\\dist\\\\module\\\\lib\\\\helpers.js -> @supabase/node-fetch\":{\"id\":\"..\\\\node_modules\\\\@supabase\\\\auth-js\\\\dist\\\\module\\\\lib\\\\helpers.js -> @supabase/node-fetch\",\"files\":[]},\"..\\\\node_modules\\\\@supabase\\\\functions-js\\\\dist\\\\module\\\\helper.js -> @supabase/node-fetch\":{\"id\":\"..\\\\node_modules\\\\@supabase\\\\functions-js\\\\dist\\\\module\\\\helper.js -> @supabase/node-fetch\",\"files\":[]},\"..\\\\node_modules\\\\@supabase\\\\realtime-js\\\\dist\\\\module\\\\RealtimeClient.js -> @supabase/node-fetch\":{\"id\":\"..\\\\node_modules\\\\@supabase\\\\realtime-js\\\\dist\\\\module\\\\RealtimeClient.js -> @supabase/node-fetch\",\"files\":[]},\"..\\\\node_modules\\\\@supabase\\\\storage-js\\\\dist\\\\module\\\\lib\\\\helpers.js -> @supabase/node-fetch\":{\"id\":\"..\\\\node_modules\\\\@supabase\\\\storage-js\\\\dist\\\\module\\\\lib\\\\helpers.js -> @supabase/node-fetch\",\"files\":[]}}"
|
||||||
@ -2,5 +2,8 @@
|
|||||||
"/_app": "pages/_app.js",
|
"/_app": "pages/_app.js",
|
||||||
"/_error": "pages/_error.js",
|
"/_error": "pages/_error.js",
|
||||||
"/_document": "pages/_document.js",
|
"/_document": "pages/_document.js",
|
||||||
"/": "pages/index.js"
|
"/": "pages/index.js",
|
||||||
|
"/admin": "pages/admin.js",
|
||||||
|
"/admin/blog": "pages/admin/blog.js",
|
||||||
|
"/api/update-blog": "pages/api/update-blog.js"
|
||||||
}
|
}
|
||||||
@ -1 +1 @@
|
|||||||
self.__BUILD_MANIFEST = {__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":["static\u002Fchunks\u002Fpages\u002Findex.js"],"/_error":["static\u002Fchunks\u002Fpages\u002F_error.js"],sortedPages:["\u002F","\u002F_app","\u002F_error"]};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()
|
self.__BUILD_MANIFEST = {__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/_error":["static\u002Fchunks\u002Fpages\u002F_error.js"],"/admin":["static\u002Fchunks\u002Fpages\u002Fadmin.js"],"/admin/blog":["static\u002Fchunks\u002Fpages\u002Fadmin\u002Fblog.js"],sortedPages:["\u002F_app","\u002F_error","\u002Fadmin","\u002Fadmin\u002Fblog"]};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()
|
||||||
54
.next/trace
54
.next/trace
File diff suppressed because one or more lines are too long
@ -389,10 +389,9 @@ export default function BlogAdmin() {
|
|||||||
{content.type === 'text' && activeContentIndex === index && (
|
{content.type === 'text' && activeContentIndex === index && (
|
||||||
<div className="border rounded-lg p-3 bg-gray-50">
|
<div className="border rounded-lg p-3 bg-gray-50">
|
||||||
<div className="text-xs font-medium text-gray-600 mb-2">Vorschau:</div>
|
<div className="text-xs font-medium text-gray-600 mb-2">Vorschau:</div>
|
||||||
<div className="prose prose-sm max-w-none">
|
<div className="prose prose-sm max-w-none whitespace-pre-wrap">
|
||||||
<ReactMarkdown
|
<ReactMarkdown
|
||||||
remarkPlugins={[remarkGfm]}
|
remarkPlugins={[remarkGfm]}
|
||||||
className="whitespace-pre-wrap"
|
|
||||||
components={{
|
components={{
|
||||||
p: ({children}) => <p className="mb-4 whitespace-pre-wrap">{children}</p>,
|
p: ({children}) => <p className="mb-4 whitespace-pre-wrap">{children}</p>,
|
||||||
code: ({node, inline, className, children, ...props}) => {
|
code: ({node, inline, className, children, ...props}) => {
|
||||||
|
|||||||
@ -1,14 +1,18 @@
|
|||||||
import { supabase } from '../../lib/supabase';
|
import { supabaseAdmin } from '../../lib/supabase';
|
||||||
|
|
||||||
export default async function handler(req, res) {
|
export default async function handler(req, res) {
|
||||||
if (req.method !== 'DELETE') {
|
if (req.method !== 'DELETE') {
|
||||||
return res.status(405).json({ error: 'Method not allowed' });
|
return res.status(405).json({ error: 'Method not allowed' });
|
||||||
}
|
}
|
||||||
|
|
||||||
const isAuthenticated = req.cookies.isAuthenticated === 'true';
|
// Get user from supabase session
|
||||||
if (!isAuthenticated) {
|
const { data: sessionData, error: authError } = await supabaseAdmin.auth.getUser(req.cookies['sb-access-token']);
|
||||||
|
|
||||||
|
if (authError || !sessionData?.user) {
|
||||||
return res.status(401).json({ error: 'Unauthorized' });
|
return res.status(401).json({ error: 'Unauthorized' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const user = sessionData.user;
|
||||||
|
|
||||||
const { id } = req.body;
|
const { id } = req.body;
|
||||||
|
|
||||||
@ -17,10 +21,11 @@ export default async function handler(req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { error } = await supabase
|
const { error } = await supabaseAdmin
|
||||||
.from('blog_entries')
|
.from('blog_entries')
|
||||||
.delete()
|
.delete()
|
||||||
.eq('id', id);
|
.eq('id', id)
|
||||||
|
.eq('author_id', user.id);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error('Supabase Lösch-Fehler:', error);
|
console.error('Supabase Lösch-Fehler:', error);
|
||||||
|
|||||||
@ -6,30 +6,38 @@ export default async function handler(req, res) {
|
|||||||
return res.status(405).json({ error: 'Method not allowed' });
|
return res.status(405).json({ error: 'Method not allowed' });
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data = req.body;
|
// Get user from supabase session
|
||||||
|
const { data: sessionData, error: authError } = await supabaseAdmin.auth.getUser(req.cookies['sb-access-token']);
|
||||||
if (!Array.isArray(data)) {
|
|
||||||
console.log('Invalid data format - not an array');
|
if (authError || !sessionData?.user) {
|
||||||
return res.status(400).json({ error: 'Data must be an array' });
|
return res.status(401).json({ error: 'Unauthorized' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const user = sessionData.user;
|
||||||
|
|
||||||
const results = [];
|
const data = req.body;
|
||||||
|
|
||||||
for (const entry of data) {
|
|
||||||
const content = Array.isArray(entry.content) ? entry.content : [];
|
|
||||||
|
|
||||||
const cleanEntry = {
|
if (!Array.isArray(data)) {
|
||||||
title: entry.title || '',
|
console.log('Invalid data format - not an array');
|
||||||
date: entry.date || '',
|
return res.status(400).json({ error: 'Data must be an array' });
|
||||||
description: entry.description || '',
|
}
|
||||||
slug: entry.slug || '',
|
|
||||||
image: entry.image || '',
|
const results = [];
|
||||||
content: content,
|
|
||||||
updated_at: new Date().toISOString()
|
|
||||||
};
|
|
||||||
|
|
||||||
const { data: result, error } = await supabaseAdmin
|
for (const entry of data) {
|
||||||
|
const content = Array.isArray(entry.content) ? entry.content : [];
|
||||||
|
|
||||||
|
const cleanEntry = {
|
||||||
|
title: entry.title || '',
|
||||||
|
date: entry.date || '',
|
||||||
|
description: entry.description || '',
|
||||||
|
slug: entry.slug || '',
|
||||||
|
image: entry.image || '',
|
||||||
|
content: content,
|
||||||
|
author_id: user.id,
|
||||||
|
updated_at: new Date().toISOString()
|
||||||
|
}; const { data: result, error } = await supabaseAdmin
|
||||||
.from('blog_entries')
|
.from('blog_entries')
|
||||||
.upsert(cleanEntry, {
|
.upsert(cleanEntry, {
|
||||||
onConflict: 'slug',
|
onConflict: 'slug',
|
||||||
|
|||||||
@ -46,7 +46,6 @@ export default function BlogPost({ blog }) {
|
|||||||
<div key={index} className="prose prose-lg max-w-none">
|
<div key={index} className="prose prose-lg max-w-none">
|
||||||
<ReactMarkdown
|
<ReactMarkdown
|
||||||
remarkPlugins={[remarkGfm]}
|
remarkPlugins={[remarkGfm]}
|
||||||
className="text-gray-700 text-base sm:text-lg leading-relaxed px-2 sm:px-0"
|
|
||||||
components={{
|
components={{
|
||||||
h1: ({children}) => <h1 className="text-3xl font-bold mb-4 text-gray-900">{children}</h1>,
|
h1: ({children}) => <h1 className="text-3xl font-bold mb-4 text-gray-900">{children}</h1>,
|
||||||
h2: ({children}) => <h2 className="text-2xl font-bold mb-3 text-gray-900">{children}</h2>,
|
h2: ({children}) => <h2 className="text-2xl font-bold mb-3 text-gray-900">{children}</h2>,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user