Compare commits

..

No commits in common. "ddec31401ee7cd453f1f7bddfe5383280e137593" and "2527056e85e663e832c7c9bca879dc03c37923fd" have entirely different histories.

7 changed files with 10 additions and 53 deletions

View File

@ -1,4 +1,4 @@
name: Build and Push Beta Image name: Build and Push Docker Image
on: on:
push: push:

View File

@ -1,4 +1,4 @@
name: Build and Push Latest Image name: Build and Push Docker Image
on: on:
push: push:

View File

@ -82,9 +82,7 @@ const aiSummary = async () => {
activateAiSummary.value = true; activateAiSummary.value = true;
isGenerating.value = true; isGenerating.value = true;
try { try {
const req = await fetch( const req = await fetch(`/api/ai/summarize/${slug}?lang=${String(locale)}`);
`/api/ai/summarize/${slug}?lang=${String(locale.value)}`,
);
const reader = req.body?.getReader(); const reader = req.body?.getReader();
const decoder = new TextDecoder(); const decoder = new TextDecoder();
while (reader) { while (reader) {

View File

@ -33,13 +33,6 @@ if (error === null) {
errorMsg.value = error.value; errorMsg.value = error.value;
} }
onMounted(() => {
if (data.length === 0) {
eerrrroorr.value = true;
errorMsg.value = "No data returned.";
}
});
async function getImageSource(image: string) { async function getImageSource(image: string) {
console.log(image); console.log(image);
if (!image || image === "#") { if (!image || image === "#") {

View File

@ -51,15 +51,6 @@ const createSources = await sql`
) )
`; `;
const createArticlesArchive = await sql`
create table if not exists news_articles (
uuid text primary key,
article_id text primary key,
jsondata json not null,
archive_timestamp timestamp default CURRENT_TIMESTAMP,
)
`;
console.log("Creation Complete"); console.log("Creation Complete");
console.log( console.log(
"If the script still does not quit after 2 seconds after the 'Creation Complete' message, please stop it by using Ctrl + C or on mac Control + C", "If the script still does not quit after 2 seconds after the 'Creation Complete' message, please stop it by using Ctrl + C or on mac Control + C",

View File

@ -1,6 +1,5 @@
import lineToday from "~/server/scrape/line_today"; import lineToday from "~/server/scrape/line_today";
import sql from "~/server/components/postgres"; import sql from "~/server/components/postgres";
import { v4 as uuidv4 } from "uuid";
interface CacheItems { interface CacheItems {
title: string; title: string;
@ -37,23 +36,6 @@ function cleanUpSlug(orgslug: string) {
return slug; return slug;
} }
// Archive articles. For future use?
async function storeArticlesIfItDoesNotExists(data, RequestId) {
const checkDataIsInDatabase = await sql`
SELECT * FROM news_articles
WHERE jsondata = ${data}
`;
if (checkDataIsInDatabase.length === 0) {
return;
}
const storeData = await sql`
INSERT INTO news_articles (uuid, article_id, jsondata)
VALUES (${uuidv4()}, ${RequestId}, ${data})
`;
console.log(storeData);
return;
}
export default defineEventHandler(async (event) => { export default defineEventHandler(async (event) => {
const translateQuery = getQuery(event).translate; const translateQuery = getQuery(event).translate;
const translate = translateQuery === "true" ? true : false; const translate = translateQuery === "true" ? true : false;
@ -72,7 +54,6 @@ export default defineEventHandler(async (event) => {
try { try {
const data = await lineToday(cleanSlug); const data = await lineToday(cleanSlug);
storeArticlesIfItDoesNotExists(data, cleanSlug);
cache[cleanSlug] = { cache[cleanSlug] = {
...data, ...data,
timestamp: Date.now(), timestamp: Date.now(),

View File

@ -1,17 +1,11 @@
import getUserTokenMinusSQLInjection from "~/server/components/getUserToken";
import sql from "~/server/components/postgres";
export default defineEventHandler(async (event) => { export default defineEventHandler(async (event) => {
const userToken = await getUserTokenMinusSQLInjection(event);
if (userToken.error.length !== 0) {
return { return {
error: userToken.error, items: [
}; {
} name: "dfasdfa",
const getData = await sql` article_link: "49redjvicjwsd",
SELECT * FROM user_other_data favTime: "2024-12-12",
WHERE username = ${userToken.user} },
`; ],
return {
items: getData[0].starred_news,
}; };
}); });