Change to axios as there is no way to get the profile pic via the raw

html & remove the legacy hot news by google rss window, (it is still
accessable via the tty interface) and update i18n with the aboutNewsOrg
thingy added articles (that currently does not work) & also added the
privacy policy & tos page, both only accessbile via the tty interface
for now. It will be avaible via the settings interface.
This commit is contained in:
yuanhau 2025-06-03 16:40:25 +08:00
parent 12455ebd28
commit f0e33905b8
10 changed files with 74 additions and 14 deletions

1
.gitignore vendored
View file

@ -36,3 +36,4 @@ _dt_*.py
# Testing files
test.vue
100106_lt_test.html

View file

@ -17,6 +17,7 @@
"@vueuse/core": "^13.2.0",
"animate.css": "^4.1.1",
"argon2": "^0.43.0",
"axios": "^1.9.0",
"cheerio": "^1.0.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",

View file

@ -16,11 +16,13 @@ const props = defineProps({
},
});
const staticProps = props;
const {
data: fetchNewsOrgInfo,
pending,
error,
} = useFetch(`/api/cached/getData/fetchNewsOrgInfo/${props.values}`, {
} = useFetch(`/api/publishers/lt/${staticProps.values}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
@ -73,18 +75,25 @@ watch(
<a
:href="fetchNewsOrgInfo?.website"
target="_blank"
v-if="fetchNewsOrgInfo?.website"
class="text-gray-800 hover:text-gray-500 transiton-all duration-150 flex flex-row"
><GlobeAltIcon class="w-6 h-6" />網站</a
>
<a
:href="fetchNewsOrgInfo?.facebook"
target="_blank"
v-if="fetchNewsOrgInfo?.facebook"
class="text-gray-800 hover:text-gray-500 transiton-all duration-150 flex flex-row"
><Facebook class="w-6 h-6" />Facebook
</a>
</div>
</div>
</div>
<div>
<div v-for="item in fetchNewsOrgInfo?.articles">
{{ item.title }}
</div>
</div>
</div>
</div>
</template>

View file

@ -0,0 +1,9 @@
<script setup lang="ts">
const { t } = useI18n();
</script>
<template>
<div class="justify-center align-center text-center">
<h1 class="text-2xl text-bold">{{ t("pages.privacypolicy.title") }}</h1>
<p>{{ t("pages.privacypolicy.content") }}</p>
</div>
</template>

View file

@ -0,0 +1,6 @@
<script setup lang="ts">
const { t } = useI18n();
</script>
<template>
<div></div>
</template>

View file

@ -104,5 +104,15 @@
"checkweirdkeywords": "This tool check if the news title has weird 18+ content.",
"noadlinetoday": "Provides free, no ads Line today."
}
},
"pages": {
"privacypolicy": {
"title": "Privacy Policy",
"content": "Ummmm"
},
"tos": {
"title": "Terms of service",
"content": "N/A"
}
}
}

View file

@ -104,5 +104,15 @@
"checkweirdkeywords": "這個工具檢查新聞記者是不是使用偏色情的標體 (台灣的很愛用)",
"noadlinetoday": "提供無廣告的LINE Today 新聞"
}
},
"pages": {
"privacypolicy": {
"title": "Privacy Policy",
"content": "Ummmm"
},
"tos": {
"title": "Terms of service",
"content": "N/A"
}
}
}

View file

@ -30,6 +30,7 @@
"@vueuse/core": "^13.2.0",
"animate.css": "^4.1.1",
"argon2": "^0.43.0",
"axios": "^1.9.0",
"cheerio": "^1.0.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",

View file

@ -41,8 +41,6 @@ interface minAppWindowInterface {
// Import plugins
import { v4 as uuidv4 } from "uuid";
import { gsap } from "gsap";
import { TextPlugin } from "gsap/TextPlugin";
gsap.registerPlugin(TextPlugin);
// Import Windows
import UserWindow from "~/components/app/windows/user.vue";
@ -56,6 +54,8 @@ import FavStaredWindow from "~/components/app/windows/fav.vue";
import NewsWindow from "~/components/app/windows/news.vue";
import NewsViewWindow from "~/components/app/windows/newsView.vue";
import SettingsWindow from "~/components/app/windows/settings.vue";
import PrivacyPolicyWindow from "~/components/app/windows/privacypolicy.vue";
import TOSWindow from "~/components/app/windows/tos.vue";
// Import Icons
import {
@ -75,9 +75,7 @@ const route = useRoute();
// values
const popMessage = ref(null);
const menuOpen = ref(false);
const langMenuOpen = ref(false);
const lang = ref(locale.value);
const alertOpen = ref(false);
2;
const currentNavBar = ref<currentNavBarInterface[]>([]);
const bootingAnimation = ref(true);
const activeWindows = ref<associAppWindowInterface[]>([]);
@ -92,13 +90,10 @@ const openingAppViaAnApp = ref(false);
const passedValues = ref();
const globalWindowVal = ref(new Map());
const changeLangAnimation = ref(false);
const openArticlesArray = ref<any[]>([]);
const openArticlesId = ref(0);
const storeStaticArticleId = ref(0);
// Key Data
const menuItems = [
{ name: t("app.hotnews"), windowName: "hotnews" },
// { name: t("app.hotnews"), windowName: "hotnews" },
{ name: t("app.news"), windowName: "news" },
{ name: t("app.sources"), windowName: "sources" },
{ name: t("app.starred"), windowName: "starred" },
@ -112,7 +107,7 @@ const menuItems = [
const associAppWindow = [
{
name: "hotnews",
name: "googlenews",
id: "1",
title: t("app.hotnews"),
component: HotNewsWindow,
@ -186,6 +181,18 @@ const associAppWindow = [
title: t("app.newsview"),
component: NewsViewWindow,
},
{
name: "privacypolicy",
id: "12",
title: t("app.privacypolicy"),
component: PrivacyPolicyWindow,
},
{
name: "tos",
id: "13",
title: t("app.tos"),
component: TOSWindow,
},
];
// Date
@ -488,7 +495,8 @@ const openNewsSourcePage = async (slug: string, title: string) => {
v-model="progress"
class="w-3/5 absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
/>
<br />
<!--Spacing for Firefox Users-->
<div class="p-2"></div>
<span class="text-xl text-bold mt-3">{{ t("app.launchtext") }}</span>
</div>
</div>
@ -591,6 +599,8 @@ const openNewsSourcePage = async (slug: string, title: string) => {
@openArticles="openArticles"
@openNewsSourcePage="openNewsSourcePage"
:values="passedValues"
:windows="activeWindows"
@closeWindow="closeWindow"
/>
</Suspense>
</DraggableWindow>

View file

@ -1,3 +1,4 @@
// TODO Add caching
import * as cheerio from "cheerio";
export default defineEventHandler(async (event) => {
@ -24,8 +25,9 @@ export default defineEventHandler(async (event) => {
.text()
.replace(/.css-.*\}/, "");
const description = html("p.description").text();
const logoClue = html("div.editor").contents();
const logo =
html("div.editor div figure img").attr("srcset") ||
logoClue.find("img").attr("srcset") ||
html("div.editor div figure img").attr("src") ||
"";
const bgImage = html("figure.keyVisual img").attr("srcset") || "";
@ -49,10 +51,11 @@ export default defineEventHandler(async (event) => {
}
});
return {
name: newsOrgName,
title: newsOrgName,
description: description,
logo: logo,
articles: otherArticles,
logoClue: String(logoClue),
};
} catch (e) {
console.log(e);