Fix timestamp bug for pending message and expand CSP for thumbnails

This commit is contained in:
sabaimran
2024-07-10 14:53:31 +05:30
parent 375685530f
commit 0369eb6e0e
3 changed files with 8 additions and 3 deletions

View File

@@ -21,7 +21,7 @@ export default function RootLayout({
script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval';
connect-src 'self' https://ipapi.co/json ws://localhost:42110;
style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com;
img-src 'self' data: https://*.khoj.dev https://*.googleusercontent.com;
img-src 'self' data: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com;
font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com;
child-src 'none';
object-src 'none';"></meta>

View File

@@ -299,7 +299,7 @@ export default function ChatHistory(props: ChatHistoryProps) {
message: props.pendingMessage,
context: [],
onlineContext: {},
created: new Date().toISOString(),
created: (new Date().getTime()).toString(),
by: "you",
automationId: '',
}

View File

@@ -267,7 +267,12 @@ export default function ChatMessage(props: ChatMessageProps) {
}
function renderTimeStamp(timestamp: string) {
const messageDateTime = new Date(timestamp + 'Z');
console.log("INCOMING TIMESTAMP", timestamp);
if (!timestamp.endsWith('Z')) {
timestamp = timestamp + 'Z';
}
const messageDateTime = new Date(timestamp);
const currentDataTime = new Date();
const timeDiff = currentDataTime.getTime() - messageDateTime.getTime();