mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 07:41:02 +08:00
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:
parent
12455ebd28
commit
f0e33905b8
1
.gitignore
vendored
1
.gitignore
vendored
@ -36,3 +36,4 @@ _dt_*.py
|
|||||||
|
|
||||||
# Testing files
|
# Testing files
|
||||||
test.vue
|
test.vue
|
||||||
|
100106_lt_test.html
|
||||||
|
1
bun.lock
1
bun.lock
@ -17,6 +17,7 @@
|
|||||||
"@vueuse/core": "^13.2.0",
|
"@vueuse/core": "^13.2.0",
|
||||||
"animate.css": "^4.1.1",
|
"animate.css": "^4.1.1",
|
||||||
"argon2": "^0.43.0",
|
"argon2": "^0.43.0",
|
||||||
|
"axios": "^1.9.0",
|
||||||
"cheerio": "^1.0.0",
|
"cheerio": "^1.0.0",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
|
@ -16,11 +16,13 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const staticProps = props;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: fetchNewsOrgInfo,
|
data: fetchNewsOrgInfo,
|
||||||
pending,
|
pending,
|
||||||
error,
|
error,
|
||||||
} = useFetch(`/api/cached/getData/fetchNewsOrgInfo/${props.values}`, {
|
} = useFetch(`/api/publishers/lt/${staticProps.values}`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@ -73,18 +75,25 @@ watch(
|
|||||||
<a
|
<a
|
||||||
:href="fetchNewsOrgInfo?.website"
|
:href="fetchNewsOrgInfo?.website"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
v-if="fetchNewsOrgInfo?.website"
|
||||||
class="text-gray-800 hover:text-gray-500 transiton-all duration-150 flex flex-row"
|
class="text-gray-800 hover:text-gray-500 transiton-all duration-150 flex flex-row"
|
||||||
><GlobeAltIcon class="w-6 h-6" />網站</a
|
><GlobeAltIcon class="w-6 h-6" />網站</a
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
:href="fetchNewsOrgInfo?.facebook"
|
:href="fetchNewsOrgInfo?.facebook"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
v-if="fetchNewsOrgInfo?.facebook"
|
||||||
class="text-gray-800 hover:text-gray-500 transiton-all duration-150 flex flex-row"
|
class="text-gray-800 hover:text-gray-500 transiton-all duration-150 flex flex-row"
|
||||||
><Facebook class="w-6 h-6" />Facebook
|
><Facebook class="w-6 h-6" />Facebook
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<div v-for="item in fetchNewsOrgInfo?.articles">
|
||||||
|
{{ item.title }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
9
components/app/windows/privacypolicy.vue
Normal file
9
components/app/windows/privacypolicy.vue
Normal 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>
|
6
components/app/windows/tos.vue
Normal file
6
components/app/windows/tos.vue
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
const { t } = useI18n();
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<div></div>
|
||||||
|
</template>
|
@ -104,5 +104,15 @@
|
|||||||
"checkweirdkeywords": "This tool check if the news title has weird 18+ content.",
|
"checkweirdkeywords": "This tool check if the news title has weird 18+ content.",
|
||||||
"noadlinetoday": "Provides free, no ads Line today."
|
"noadlinetoday": "Provides free, no ads Line today."
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"pages": {
|
||||||
|
"privacypolicy": {
|
||||||
|
"title": "Privacy Policy",
|
||||||
|
"content": "Ummmm"
|
||||||
|
},
|
||||||
|
"tos": {
|
||||||
|
"title": "Terms of service",
|
||||||
|
"content": "N/A"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,5 +104,15 @@
|
|||||||
"checkweirdkeywords": "這個工具檢查新聞記者是不是使用偏色情的標體 (台灣的很愛用)",
|
"checkweirdkeywords": "這個工具檢查新聞記者是不是使用偏色情的標體 (台灣的很愛用)",
|
||||||
"noadlinetoday": "提供無廣告的LINE Today 新聞"
|
"noadlinetoday": "提供無廣告的LINE Today 新聞"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"pages": {
|
||||||
|
"privacypolicy": {
|
||||||
|
"title": "Privacy Policy",
|
||||||
|
"content": "Ummmm"
|
||||||
|
},
|
||||||
|
"tos": {
|
||||||
|
"title": "Terms of service",
|
||||||
|
"content": "N/A"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
"@vueuse/core": "^13.2.0",
|
"@vueuse/core": "^13.2.0",
|
||||||
"animate.css": "^4.1.1",
|
"animate.css": "^4.1.1",
|
||||||
"argon2": "^0.43.0",
|
"argon2": "^0.43.0",
|
||||||
|
"axios": "^1.9.0",
|
||||||
"cheerio": "^1.0.0",
|
"cheerio": "^1.0.0",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
|
@ -41,8 +41,6 @@ interface minAppWindowInterface {
|
|||||||
// Import plugins
|
// Import plugins
|
||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
import { gsap } from "gsap";
|
import { gsap } from "gsap";
|
||||||
import { TextPlugin } from "gsap/TextPlugin";
|
|
||||||
gsap.registerPlugin(TextPlugin);
|
|
||||||
|
|
||||||
// Import Windows
|
// Import Windows
|
||||||
import UserWindow from "~/components/app/windows/user.vue";
|
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 NewsWindow from "~/components/app/windows/news.vue";
|
||||||
import NewsViewWindow from "~/components/app/windows/newsView.vue";
|
import NewsViewWindow from "~/components/app/windows/newsView.vue";
|
||||||
import SettingsWindow from "~/components/app/windows/settings.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 Icons
|
||||||
import {
|
import {
|
||||||
@ -75,9 +75,7 @@ const route = useRoute();
|
|||||||
// values
|
// values
|
||||||
const popMessage = ref(null);
|
const popMessage = ref(null);
|
||||||
const menuOpen = ref(false);
|
const menuOpen = ref(false);
|
||||||
const langMenuOpen = ref(false);
|
2;
|
||||||
const lang = ref(locale.value);
|
|
||||||
const alertOpen = ref(false);
|
|
||||||
const currentNavBar = ref<currentNavBarInterface[]>([]);
|
const currentNavBar = ref<currentNavBarInterface[]>([]);
|
||||||
const bootingAnimation = ref(true);
|
const bootingAnimation = ref(true);
|
||||||
const activeWindows = ref<associAppWindowInterface[]>([]);
|
const activeWindows = ref<associAppWindowInterface[]>([]);
|
||||||
@ -92,13 +90,10 @@ const openingAppViaAnApp = ref(false);
|
|||||||
const passedValues = ref();
|
const passedValues = ref();
|
||||||
const globalWindowVal = ref(new Map());
|
const globalWindowVal = ref(new Map());
|
||||||
const changeLangAnimation = ref(false);
|
const changeLangAnimation = ref(false);
|
||||||
const openArticlesArray = ref<any[]>([]);
|
|
||||||
const openArticlesId = ref(0);
|
|
||||||
const storeStaticArticleId = ref(0);
|
|
||||||
|
|
||||||
// Key Data
|
// Key Data
|
||||||
const menuItems = [
|
const menuItems = [
|
||||||
{ name: t("app.hotnews"), windowName: "hotnews" },
|
// { name: t("app.hotnews"), windowName: "hotnews" },
|
||||||
{ name: t("app.news"), windowName: "news" },
|
{ name: t("app.news"), windowName: "news" },
|
||||||
{ name: t("app.sources"), windowName: "sources" },
|
{ name: t("app.sources"), windowName: "sources" },
|
||||||
{ name: t("app.starred"), windowName: "starred" },
|
{ name: t("app.starred"), windowName: "starred" },
|
||||||
@ -112,7 +107,7 @@ const menuItems = [
|
|||||||
|
|
||||||
const associAppWindow = [
|
const associAppWindow = [
|
||||||
{
|
{
|
||||||
name: "hotnews",
|
name: "googlenews",
|
||||||
id: "1",
|
id: "1",
|
||||||
title: t("app.hotnews"),
|
title: t("app.hotnews"),
|
||||||
component: HotNewsWindow,
|
component: HotNewsWindow,
|
||||||
@ -186,6 +181,18 @@ const associAppWindow = [
|
|||||||
title: t("app.newsview"),
|
title: t("app.newsview"),
|
||||||
component: NewsViewWindow,
|
component: NewsViewWindow,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "privacypolicy",
|
||||||
|
id: "12",
|
||||||
|
title: t("app.privacypolicy"),
|
||||||
|
component: PrivacyPolicyWindow,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "tos",
|
||||||
|
id: "13",
|
||||||
|
title: t("app.tos"),
|
||||||
|
component: TOSWindow,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
@ -488,7 +495,8 @@ const openNewsSourcePage = async (slug: string, title: string) => {
|
|||||||
v-model="progress"
|
v-model="progress"
|
||||||
class="w-3/5 absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
|
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>
|
<span class="text-xl text-bold mt-3">{{ t("app.launchtext") }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -591,6 +599,8 @@ const openNewsSourcePage = async (slug: string, title: string) => {
|
|||||||
@openArticles="openArticles"
|
@openArticles="openArticles"
|
||||||
@openNewsSourcePage="openNewsSourcePage"
|
@openNewsSourcePage="openNewsSourcePage"
|
||||||
:values="passedValues"
|
:values="passedValues"
|
||||||
|
:windows="activeWindows"
|
||||||
|
@closeWindow="closeWindow"
|
||||||
/>
|
/>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
</DraggableWindow>
|
</DraggableWindow>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// TODO Add caching
|
||||||
import * as cheerio from "cheerio";
|
import * as cheerio from "cheerio";
|
||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
@ -24,8 +25,9 @@ export default defineEventHandler(async (event) => {
|
|||||||
.text()
|
.text()
|
||||||
.replace(/.css-.*\}/, "");
|
.replace(/.css-.*\}/, "");
|
||||||
const description = html("p.description").text();
|
const description = html("p.description").text();
|
||||||
|
const logoClue = html("div.editor").contents();
|
||||||
const logo =
|
const logo =
|
||||||
html("div.editor div figure img").attr("srcset") ||
|
logoClue.find("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 bgImage = html("figure.keyVisual img").attr("srcset") || "";
|
||||||
@ -49,10 +51,11 @@ export default defineEventHandler(async (event) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
name: newsOrgName,
|
title: newsOrgName,
|
||||||
description: description,
|
description: description,
|
||||||
logo: logo,
|
logo: logo,
|
||||||
articles: otherArticles,
|
articles: otherArticles,
|
||||||
|
logoClue: String(logoClue),
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user