mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 15:51:01 +08:00
Compare commits
No commits in common. "a0cf894a11448bbacca3718aa5765ffe74c9b98e" and "23823da18bdecbe86d5d4011ed1206bb50985b01" have entirely different histories.
a0cf894a11
...
23823da18b
@ -1,10 +0,0 @@
|
|||||||
import currentVersion from "~/versionTag";
|
|
||||||
export default async function newestVersion() {
|
|
||||||
const current = currentVersion();
|
|
||||||
const req = await fetch("/api/version");
|
|
||||||
const res = await req.json();
|
|
||||||
if (current !== res.version) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
@ -47,9 +47,6 @@ import { gsap } from "gsap";
|
|||||||
import confetti from "js-confetti";
|
import confetti from "js-confetti";
|
||||||
import translate from "translate";
|
import translate from "translate";
|
||||||
|
|
||||||
// Import Scripts
|
|
||||||
import checkAppVersion from "~/components/checkAppVersion";
|
|
||||||
|
|
||||||
// Import Windows
|
// Import Windows
|
||||||
import UserWindow from "~/components/app/windows/user.vue";
|
import UserWindow from "~/components/app/windows/user.vue";
|
||||||
import SourcesWindow from "~/components/app/windows/sources.vue";
|
import SourcesWindow from "~/components/app/windows/sources.vue";
|
||||||
@ -102,7 +99,6 @@ const applyForTranslation = ref(false);
|
|||||||
const langPrefDifferent = ref(false);
|
const langPrefDifferent = ref(false);
|
||||||
const notLoggedInState = ref(false);
|
const notLoggedInState = ref(false);
|
||||||
const translateProvider = ref("");
|
const translateProvider = ref("");
|
||||||
const newUpdate = ref(false);
|
|
||||||
|
|
||||||
// Key Data
|
// Key Data
|
||||||
const menuItems = [
|
const menuItems = [
|
||||||
@ -624,12 +620,6 @@ onMounted(async () => {
|
|||||||
translateProvider.value = loadUserInfoData.translate.provider || "google";
|
translateProvider.value = loadUserInfoData.translate.provider || "google";
|
||||||
console.log(langPrefDifferent);
|
console.log(langPrefDifferent);
|
||||||
});*/
|
});*/
|
||||||
|
|
||||||
// Get ghe newest update
|
|
||||||
const newUpdateTimer = 1000 * 60 * 3; // Check for thime every 3 min.
|
|
||||||
setInterval(async () => {
|
|
||||||
newUpdate.value = await checkAppVersion();
|
|
||||||
}, newUpdateTimer);
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div v-if="changeLangAnimation">
|
<div v-if="changeLangAnimation">
|
||||||
@ -755,35 +745,6 @@ setInterval(async () => {
|
|||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
<!--New Update-->
|
|
||||||
<Dialog v-model:open="langPrefDifferent">
|
|
||||||
<DialogContent class="!border-0 !bg-black !rounded">
|
|
||||||
<DialogHeader>
|
|
||||||
<DialogTitle>There is a new Update!</DialogTitle>
|
|
||||||
<DialogDescription>
|
|
||||||
Click notify later to save your current tasks & update the page.
|
|
||||||
</DialogDescription>
|
|
||||||
</DialogHeader>
|
|
||||||
<DialogFooter>
|
|
||||||
<Button
|
|
||||||
@click="
|
|
||||||
() => {
|
|
||||||
newUpdate.value = false;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
variant="outline"
|
|
||||||
>
|
|
||||||
Notify later
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
@click="() => window.location.reload('/desktop')"
|
|
||||||
variant="outline"
|
|
||||||
>
|
|
||||||
Update
|
|
||||||
</Button>
|
|
||||||
</DialogFooter>
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
<!--Window system-->
|
<!--Window system-->
|
||||||
<Transition>
|
<Transition>
|
||||||
<div>
|
<div>
|
||||||
|
@ -38,32 +38,20 @@ function cleanUpSlug(orgslug: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Archive articles. For future use?
|
// Archive articles. For future use?
|
||||||
function storeArticlesIfItDoesNotExists(data, RequestId) {
|
async function storeArticlesIfItDoesNotExists(data, RequestId) {
|
||||||
try {
|
|
||||||
setImmediate(async () => {
|
|
||||||
try {
|
|
||||||
const checkDataIsInDatabase = await sql`
|
const checkDataIsInDatabase = await sql`
|
||||||
SELECT uuid FROM news_articles
|
SELECT * FROM news_articles
|
||||||
WHERE article_id = ${RequestId}
|
WHERE jsondata = ${data}
|
||||||
LIMIT 1
|
|
||||||
`;
|
`;
|
||||||
if (checkDataIsInDatabase.length > 0) {
|
if (checkDataIsInDatabase.length > 0) {
|
||||||
console.log(`Article ${RequestId} already exists in database`);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const jsonData = JSON.stringify(data);
|
const storeData = await sql`
|
||||||
await sql`
|
|
||||||
INSERT INTO news_articles (uuid, article_id, jsondata)
|
INSERT INTO news_articles (uuid, article_id, jsondata)
|
||||||
VALUES (${uuidv4()}, ${RequestId}, ${jsonData}::JSON)
|
VALUES (${uuidv4()}, ${RequestId}, ${data}::JSON)
|
||||||
`;
|
`;
|
||||||
console.log(`Successfully archived article ${RequestId} in background`);
|
console.log(storeData);
|
||||||
} catch (error) {
|
return;
|
||||||
console.error("Failed to archive article in background:", error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Failed to initiate background archiving:", error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user