it works rn ig?

This commit is contained in:
吳元皓 2025-06-02 14:43:13 +08:00
parent 8eb19d7242
commit 3ebaff5218
4 changed files with 39 additions and 13 deletions

View File

@ -34,6 +34,7 @@ const switchTabs = ref(false);
const tabs = ref([]); const tabs = ref([]);
const primary = ref<string>("top"); // Hard code value fn const primary = ref<string>("top"); // Hard code value fn
const canNotLoadTabUI = ref(false); const canNotLoadTabUI = ref(false);
const isDataCached = ref(false);
const pullTabsData = async () => { const pullTabsData = async () => {
try { try {
const req = await fetch("/api/tabs"); const req = await fetch("/api/tabs");
@ -60,6 +61,7 @@ const updateContent = async (url: string, tabAction: boolean) => {
if (data) { if (data) {
contentArray.value = [...data.uuidData, ...(data.nuuiddata?.items || [])]; contentArray.value = [...data.uuidData, ...(data.nuuiddata?.items || [])];
switchTabs.value = false; switchTabs.value = false;
isDataCached.value = data.cached || false;
} }
} catch (e) { } catch (e) {
console.log(e); console.log(e);

View File

@ -5,7 +5,7 @@ const { t, locale } = useI18n();
const user = ref(); const user = ref();
onMounted(async () => { onMounted(async () => {
const req = await fetch("/api/user/validateUserToken"); const req = await fetch("/api/user/validateUserToken");
const res = req.json(); const res = await req.json();
user.value = res; user.value = res;
}); });
@ -27,13 +27,16 @@ const submitCustomApiKey = async () => {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
body: JSON.stringify({}), body: JSON.stringify({
apiKey: apiKey,
}),
}); });
const data = await sendApi.json(); const data = await sendApi.json();
if (data.error) { if (data.error) {
} }
} catch (e) {} } catch (e) {}
}; };
const checkValidApiKey = () => { const checkValidApiKey = () => {
const apiKey = customApiKey.value; const apiKey = customApiKey.value;
if (!apiKey) { if (!apiKey) {
@ -58,9 +61,18 @@ const checkValidApiKey = () => {
v-on:mouseleave="checkValidApiKey" v-on:mouseleave="checkValidApiKey"
/> />
<!--If it is a valid api key or not.--> <!--If it is a valid api key or not.-->
<BadgeCheckIcon v-if="isCorrect" class="w-8 h-8 p-1/2 mr-1 text-green-700"/> <BadgeCheckIcon
<OctagonAlertIcon v-if="!isCorrect" class="w-8 h-8 p-1/2 mr-1 text-red-700"/> v-if="isCorrect"
<button class="p-1 text-sm bg-gray-400/60 rounded" @click="submitCustomApiKey"> class="w-8 h-8 p-1/2 mr-1 text-green-700"
/>
<OctagonAlertIcon
v-if="!isCorrect"
class="w-8 h-8 p-1/2 mr-1 text-red-700"
/>
<button
class="p-1 text-sm bg-gray-400/60 rounded"
@click="submitCustomApiKey"
>
Submit Submit
</button> </button>
</div> </div>

View File

@ -269,7 +269,6 @@ const navBarDisplayText = (text: string) => {
} }
const trimSpaces = text.trim(); const trimSpaces = text.trim();
const regex = /.{0,7}/; const regex = /.{0,7}/;
console.log("asdasda");
if (trimSpaces.length <= 7) { if (trimSpaces.length <= 7) {
return text; return text;
} }

View File

@ -28,12 +28,25 @@ export default defineEventHandler(async (event) => {
html("div.editor div figure img").attr("srcset") || html("div.editor div figure img").attr("srcset") ||
html("div.editor div figure img").attr("src") || html("div.editor div figure img").attr("src") ||
""; "";
const bgImage = html("figure.keyVisual img").attr("srcset") || "";
const articles = []; const articles = [];
const otherArticles = html("section.moduleContainer div").html(); const regexArticleLinks = /[a-zA-Z0-9]{7}/g
/*for (const item in otherArticles) { const otherArticles = <any[]>[];
console.log(item); html("a.ltcp-link")
console.log("-"); .each((i, element) => {
}*/ const articleLink = html(element).attr("href");
const articleTitle = html(element).find("h3.header").text();
const date = html(element).find("div._articleCard div.css-wqleh6 span").text();
if (articleLink && articleTitle) {
const articleSlug = articleLink.matchAll(regexArticleLinks);
otherArticles.push({
index: i,
title: articleTitle,
link: articleSlug,
date: date,
});
}
});
return { return {
name: newsOrgName, name: newsOrgName,
description: description, description: description,