Skip to content

Commit

Permalink
feat: cookie test
Browse files Browse the repository at this point in the history
  • Loading branch information
akurilov committed Mar 21, 2024
1 parent 8acbfdc commit 5c2de08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion helm/webapp/values-demo-0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ingress:
- host: awakari.com
cookie:
enabled: true
name: "awakari"
name: "awkappuser"
expires:
seconds: 86400
samesite: "Strict"
Expand Down
21 changes: 10 additions & 11 deletions web/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ async function startEventsLoading(subId, deadline) {
}
}

const templateEvent = (txt, time, srcUrl, link, id) => `
const templateEvent = (txt, time, src, link, id) => `
<div class="p-1 shadow-xs border dark:border-gray-600 h-12 w-86 sm:w-[624px] flex align-middle">
<a href="${link}" target="_blank" class="w-80 sm:w-[586px]">
<p class="text-gray-700 dark:text-gray-300 hover:text-blue-500 truncate">
Expand All @@ -274,13 +274,11 @@ const templateEvent = (txt, time, srcUrl, link, id) => `
<span class="text-stone-500">
${time.getHours().toString().padStart(2, '0')}:${time.getMinutes().toString().padStart(2, '0')}:${time.getSeconds().toString().padStart(2, '0')}
</span>
<span class="text-slate-600 dark:text-slate-400 truncate">
${srcUrl.host}<span class="text-slate-500 truncate">${srcUrl.pathname}</span>
</span>
<span class="text-slate-600 dark:text-slate-400 truncate">${src}</span>
</p>
</a>
<button type="button"
onclick="reportPublicationInappropriate('${srcUrl}', '${link}', '${id}')"
onclick="reportPublicationInappropriate('${src}', '${link}', '${id}')"
class="m-1 flex report justify-center text-center text-xl h-6 w-6 text-stone-500 hover:text-amber-500">
</button>
Expand All @@ -299,18 +297,19 @@ function displayEvents(evts) {
} else {
time = new Date();
}
let src = evt.source;
if (src.startsWith("@")) {
src = `https://t.me/${src.substring(1)}`;
let link = evt.source;
if (link.startsWith("@")) {
link = `https://t.me/${link.substring(1)}`;
}
if (!link.startsWith("http://") || !link.startsWith("https")) {
link = `https://${link}`;
}
let link = src;
if (evt.attributes.hasOwnProperty("object") && evt.attributes.object.hasOwnProperty("ce_uri")) {
link = evt.attributes.object.ce_uri;
}
if (evt.attributes.hasOwnProperty("objecturl")) {
link = evt.attributes.objecturl.ce_uri;
}
const srcUrl = new URL(src);
let txt = evt.text_data;
if (evt.attributes.hasOwnProperty("summary")) {
txt = evt.attributes.summary.ce_string;
Expand All @@ -319,6 +318,6 @@ function displayEvents(evts) {
txt = evt.attributes.title.ce_string;
}
txt = txt.replace(/(<([^>]+)>)/gi, ""); // remove HTML tags
elemEvts.innerHTML = templateEvent(txt, time, srcUrl, link, evt.id) + elemEvts.innerHTML;
elemEvts.innerHTML = templateEvent(txt, time, evt.source, link, evt.id) + elemEvts.innerHTML;
}
}

0 comments on commit 5c2de08

Please sign in to comment.