Enhance SEO and feedback features across the application
- Updated index.html with improved meta tags for SEO, including author and theme color. - Added a feedback dialog in ImprintContainer.vue for user feedback submission. - Refactored LoginForm.vue to utilize a utility for cookie management, simplifying profile persistence. - Introduced new routes and schemas for feedback in the router and server, enhancing SEO and user experience. - Improved ChatView.vue with better error handling and command table display. - Implemented feedback API endpoints in server routes for managing user feedback submissions and admin access. These changes collectively improve the application's SEO, user interaction, and feedback management capabilities.
This commit is contained in:
39
client/src/utils/profileCookie.js
Normal file
39
client/src/utils/profileCookie.js
Normal file
@@ -0,0 +1,39 @@
|
||||
const PROFILE_COOKIE_NAME = 'singlechat_profile';
|
||||
const PROFILE_COOKIE_MAX_AGE = 60 * 60 * 24 * 365;
|
||||
|
||||
function readCookie(name) {
|
||||
const prefix = `${name}=`;
|
||||
const cookie = document.cookie
|
||||
.split('; ')
|
||||
.find((entry) => entry.startsWith(prefix));
|
||||
|
||||
return cookie ? cookie.slice(prefix.length) : null;
|
||||
}
|
||||
|
||||
export function readProfileCookie() {
|
||||
const cookieValue = readCookie(PROFILE_COOKIE_NAME);
|
||||
if (!cookieValue) return null;
|
||||
|
||||
try {
|
||||
return JSON.parse(decodeURIComponent(cookieValue));
|
||||
} catch (error) {
|
||||
console.warn('Profil-Cookie konnte nicht gelesen werden:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function writeProfileCookie(profile) {
|
||||
const normalizedProfile = {
|
||||
nickname: typeof profile.nickname === 'string' ? profile.nickname.trim() : '',
|
||||
gender: typeof profile.gender === 'string' ? profile.gender : '',
|
||||
age: Number(profile.age) || 18,
|
||||
country: typeof profile.country === 'string' ? profile.country : ''
|
||||
};
|
||||
|
||||
document.cookie = [
|
||||
`${PROFILE_COOKIE_NAME}=${encodeURIComponent(JSON.stringify(normalizedProfile))}`,
|
||||
`Max-Age=${PROFILE_COOKIE_MAX_AGE}`,
|
||||
'Path=/',
|
||||
'SameSite=Lax'
|
||||
].join('; ');
|
||||
}
|
||||
Reference in New Issue
Block a user