mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-25 13:46:05 +00:00
Compare commits
No commits in common. "8b739832783b0156472ac136b11bf03812bea5d3" and "dfd9bb274d1194481c6ea033a1aa4dbe6507ebdb" have entirely different histories.
8b73983278
...
dfd9bb274d
9 changed files with 39 additions and 64 deletions
|
@ -8,16 +8,8 @@ const openApp = (link: string) => {
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<BlurPageBeforeLogin>
|
<BlurPageBeforeLogin>
|
||||||
<div v-if="!favData.items">
|
|
||||||
<div
|
|
||||||
class="absolute inset-0 flex flex-col justify-center align-center text-center"
|
|
||||||
>
|
|
||||||
<h2>{{t("fav.haventaddedyet")}}</h2>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
<div
|
||||||
class="justify-center text-center align-center flex flex-row flex-wrap"
|
class="justify-center text-center align-center flex flex-row flex-wrap"
|
||||||
v-else
|
|
||||||
>
|
>
|
||||||
<div v-for="items in favData.items">
|
<div v-for="items in favData.items">
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -31,7 +31,6 @@ const isGenerating = ref(false);
|
||||||
const summaryText = ref("");
|
const summaryText = ref("");
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
const likeart = ref([]);
|
const likeart = ref([]);
|
||||||
const staredStatus = ref(false);
|
|
||||||
// Translating logic
|
// Translating logic
|
||||||
const translateText = ref(false);
|
const translateText = ref(false);
|
||||||
const translatedBefore = ref(false);
|
const translatedBefore = ref(false);
|
||||||
|
@ -106,21 +105,6 @@ const aiSummary = async () => {
|
||||||
isGenerating.value = false;
|
isGenerating.value = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const starArticle = async () => {
|
|
||||||
const buildUrl = `/user/${slug}/fav`;
|
|
||||||
const req = await fetch(buildUrl);
|
|
||||||
const res = await req.json();
|
|
||||||
if (res.status === "success") {
|
|
||||||
staredStatus.value = res.starred;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
const req = await fetch(`/user/${slug}/star`);
|
|
||||||
const res = await req.json();
|
|
||||||
staredStatus.value = res;
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
|
@ -189,25 +173,17 @@ onMounted(async () => {
|
||||||
<div v-else>{{ summaryText }}</div>
|
<div v-else>{{ summaryText }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--<div class="flex flex-col bg-gray-500">
|
<div class="flex flex-col bg-gray-500">
|
||||||
<!--Similar articles-->
|
<!--Similar articles-->
|
||||||
<!--<div class="flex flex-row" v-for="item in likeart">
|
<div class="flex flex-row" v-for="item in likeart">
|
||||||
<img /><!--Image-->
|
<img /><!--Image-->
|
||||||
<!--<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<h2>title</h2>
|
<h2>title</h2>
|
||||||
<span>description</span>
|
<span>description</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>-->
|
</div>
|
||||||
<button
|
<button><StarIcon /></button>
|
||||||
@click="starArticle"
|
|
||||||
:class="[
|
|
||||||
'duration-300 transition-all',
|
|
||||||
{ 'fill-blue-500 text-blue-500': staredStatus },
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<StarIcon />
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -11,8 +11,8 @@ const props = defineProps<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const openNewWindow = (itemId: string) => {
|
const openNewWindow = (itemId: string) => {
|
||||||
emit("loadValue", itemId);
|
|
||||||
emit("windowopener", "aboutNewsOrg");
|
emit("windowopener", "aboutNewsOrg");
|
||||||
|
emit("loadValue", itemId);
|
||||||
};
|
};
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -78,9 +78,9 @@ onMounted(async () => {
|
||||||
{{ errorMsg }}
|
{{ errorMsg }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-row flex-wrap justify-center gap-2">
|
<div class="flex flex-row flexw-wrap justify-center gap-2">
|
||||||
<div
|
<div
|
||||||
class="flex flex-col group bg-gray-900/30 rounded-xl p-3 transition-all shadow-lg hover:translate-y-[-2px] ransition-all duration-500 max-w-1/2"
|
class="flex flex-col group bg-gray-900/30 rounded-xl p-3 transition-all duration-500 shadow-lg hover:translate-y-[-2px] ransition-all duration-700"
|
||||||
v-for="item in source?.data"
|
v-for="item in source?.data"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
>
|
>
|
||||||
|
|
|
@ -7,6 +7,16 @@ const error = ref(false);
|
||||||
const errorMsg = ref("");
|
const errorMsg = ref("");
|
||||||
const emit = defineEmits(["windowopener", "error", "loadValue"]);
|
const emit = defineEmits(["windowopener", "error", "loadValue"]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return {
|
||||||
|
userAccount: fetchViaSQL[0].username,
|
||||||
|
firstName: fetchViaSQL[0].firstName,
|
||||||
|
requested_action: "CONTINUE",
|
||||||
|
current_spot: "KEEP_LOGIN",
|
||||||
|
email: fetchViaSQL[0].email,
|
||||||
|
avatarURL: fetchViaSQL[0].avatarurl,
|
||||||
|
};
|
||||||
|
*/
|
||||||
try {
|
try {
|
||||||
// 喔 我沒有加 await :( 難怪有問題
|
// 喔 我沒有加 await :( 難怪有問題
|
||||||
const { data, error: sendError } = await useFetch(
|
const { data, error: sendError } = await useFetch(
|
||||||
|
@ -15,8 +25,11 @@ try {
|
||||||
if (sendError.value) {
|
if (sendError.value) {
|
||||||
error.value = true;
|
error.value = true;
|
||||||
}
|
}
|
||||||
if (data.value.requested_action === "CONTINUE") {
|
if (data.requested_action === "LOGOUT_USER") {
|
||||||
if (data.value.userAccount && data.value.userAccount.length !== 0) {
|
logoutUser();
|
||||||
|
}
|
||||||
|
if (data.requested_action === "CONTINUE") {
|
||||||
|
if (data.userAccount && data.userAccount.length !== 0) {
|
||||||
allowed.value = true;
|
allowed.value = true;
|
||||||
} else {
|
} else {
|
||||||
allowed.value = false;
|
allowed.value = false;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import currentVersion from "~/versionTag";
|
import currentVersion from "~/versionTag";
|
||||||
|
export default async function newestVersion() {
|
||||||
export default async function newestVersion() {
|
export default async function newestVersion() {
|
||||||
const current = currentVersion();
|
const current = currentVersion();
|
||||||
const req = await fetch("/api/version");
|
const req = await fetch("/api/version");
|
||||||
|
@ -10,3 +11,4 @@ export default async function newestVersion() {
|
||||||
const { version: latest } = await req.json();
|
const { version: latest } = await req.json();
|
||||||
return current === latest; // `true` ➜ up-to-date
|
return current === latest; // `true` ➜ up-to-date
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -148,8 +148,5 @@
|
||||||
"nosimilararticles": "There aren't any similar articles.",
|
"nosimilararticles": "There aren't any similar articles.",
|
||||||
"articleopenpart1": "This will open a open a new window about this new org",
|
"articleopenpart1": "This will open a open a new window about this new org",
|
||||||
"articleopenpart2": ""
|
"articleopenpart2": ""
|
||||||
},
|
|
||||||
"fav": {
|
|
||||||
"haventaddedyet": "You haven't added any favorites yet."
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
"license": "授權",
|
"license": "授權",
|
||||||
"search": "搜尋",
|
"search": "搜尋",
|
||||||
"chatbot": "聊天機器人",
|
"chatbot": "聊天機器人",
|
||||||
"starred": "我的最愛",
|
"starred": "收藏",
|
||||||
"terminal": "終端機",
|
"terminal": "終端機",
|
||||||
"aboutNewsOrg": "關於這個新聞來源",
|
"aboutNewsOrg": "關於這個新聞來源",
|
||||||
"newsview": "新聞",
|
"newsview": "新聞",
|
||||||
|
@ -146,8 +146,5 @@
|
||||||
"nosimilararticles": "找不到類似文章",
|
"nosimilararticles": "找不到類似文章",
|
||||||
"articleopenpart1": "會打開關於媒體",
|
"articleopenpart1": "會打開關於媒體",
|
||||||
"articleopenpart2": "的視窗"
|
"articleopenpart2": "的視窗"
|
||||||
},
|
|
||||||
"fav": {
|
|
||||||
"haventaddedyet": "你尚未把新聞加入我的最愛"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
"groq-sdk": "^0.23.0",
|
"groq-sdk": "^0.22.0",
|
||||||
"gsap": "^3.13.0",
|
"gsap": "^3.13.0",
|
||||||
"html-to-json-parser": "^2.0.1",
|
"html-to-json-parser": "^2.0.1",
|
||||||
"js-confetti": "^0.12.0",
|
"js-confetti": "^0.12.0",
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"reka-ui": "^2.3.1",
|
"reka-ui": "^2.3.1",
|
||||||
"rss-parser": "^3.13.0",
|
"rss-parser": "^3.13.0",
|
||||||
"shadcn-nuxt": "2.2.0",
|
"shadcn-nuxt": "2.1.0",
|
||||||
"tailwind-merge": "^3.3.1",
|
"tailwind-merge": "^3.3.1",
|
||||||
"tailwind-scrollbar": "^4.0.2",
|
"tailwind-scrollbar": "^4.0.2",
|
||||||
"tailwindcss": "^3.4.17",
|
"tailwindcss": "^3.4.17",
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
import getUserTokenMinusSQLInjection from "~/server/components/getUserToken";
|
import getUserTokenMinusSQLInjection from "~/server/components/getUserToken";
|
||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
const userToken = await getUserTokenMinusSQLInjection(event);
|
const loginCookie = await getUserTokenMinusSQLInjection(event);
|
||||||
if (userToken.error.length !== 0) {
|
|
||||||
return {
|
|
||||||
error: userToken.error,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
|
if (false) {
|
||||||
deleteCookie(event, "token");
|
deleteCookie(event, "token");
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
error: null,
|
error: null,
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
return "testing";
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue