From a8d675e2ae1a28c7cff7d8e18234429d06a9866e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B3=E5=85=83=E7=9A=93?= Date: Sat, 7 Jun 2025 14:51:40 +0800 Subject: [PATCH] AboutNewsOrg & newsView is now abosolutely working !!! :D Also updated some README as well :) --- README.ZH_TW.md | 2 +- README.md | 3 +++ components/app/windows/aboutNewsOrg.vue | 31 ++++++++++++++++++------- components/app/windows/newsView.vue | 21 +++++++++++++---- 4 files changed, 43 insertions(+), 14 deletions(-) diff --git a/README.ZH_TW.md b/README.ZH_TW.md index 58a152c..51b99fe 100644 --- a/README.ZH_TW.md +++ b/README.ZH_TW.md @@ -18,7 +18,7 @@ Reverse engineering 文檔: [about](/about/) ## 在部署之前,請先知道: 此程式碼絕對不是為在 Vercel 或 Netlify 上啟動而設計的,它現在在主網站程式碼中具有crawling,而且整個「快取功能」都基於Ram,所以請不要使用這些平台,對於 Zeabur 來說,您的成本一定會比較貴一點。網址:https://news.yuanhau.com 託管在我自己的infra上,你也應該這麼做。可以在Yahoo拍賣、蝦皮取得伺服器來執行這個程式。 -## Note for deing +## Note for developing The desktop enviroment is super unstable when even using a beefy computer, even so, the desktop will lag when opening the newsView, like it's just hates being in a dev env. Prod app works tho, so you can demo it using `bun run build && bun run preview` for demoing. Please don't file a issue request for this matter. If you have the fix, please contribute using Github PRs. ## 為什麼? diff --git a/README.md b/README.md index 8acb24d..4c5f38e 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,9 @@ Deploy: [via docker compose](/deploy.md) ## Demo: You can try out the app RIGHT NOW via this link: https://yhw.tw/news?goto=desktop +## Using Translations: +A few pages now contains translations, like the aboutNewsOrg & newsView pages. This project currently is using Google Translate. However, muiti translate platform support is coming soon™ (If you login with your account). The translations are not accrate at all, like something that should be `I just want to write about sports` becomes `I just want to write`, that bro, what is even that? + ## Before deploying, please know this: This code is absolutly NOT designed to be spinned up at Vercel or Netlify, it has the scraping system now inside of the main website code, oh also the entire "caching feature" is based in memory, so please don't use those platforms, for Zeabur your cost might be expensive. idk, I haven't tried hit yet. The web url: https://news.yuanhau.com is hosted on my own infra, you should too. Please get a server off of yahoo 拍賣, 蝦皮 or eBay to do so. diff --git a/components/app/windows/aboutNewsOrg.vue b/components/app/windows/aboutNewsOrg.vue index c70184e..0c45085 100644 --- a/components/app/windows/aboutNewsOrg.vue +++ b/components/app/windows/aboutNewsOrg.vue @@ -85,33 +85,43 @@ const startTranslating = async (text: string) => { const translateText = ref(false); const translatedBefore = ref(false); const traslateFailed = ref(false); +const displayTranslatedText = ref(false); +const loadingTranslations = ref(false); watch( () => props.applyForTranslation, (value) => { if (value === true) { translateText.value = true; - if (!data.value) { + if (!fetchNewsOrgInfo.value) { return; } if (translatedBefore.value === true) { + displayTranslatedText.value = true; return; } + loadingTranslations.value = true; startTranslating(fetchNewsOrgInfo.value?.title); - startTranslating(fetchNewsOrgInfo.value?.origin); - startTranslating(fetchNewsOrgInfo.value?.author); + startTranslating(fetchNewsOrgInfo.value?.description); for (const articles of fetchNewsOrgInfo.value?.articles) { startTranslating(articles.title.replaceAll("獨家專欄》", "")); startTranslating(articles.date); } // NOT retranslating AGAIN when disabling the feat translatedBefore.value = true; + setTimeout(() => { + displayTranslatedText.value = true; + loadingTranslations.value = false; + }, 3000); } else { translateText.value = false; + displayTranslatedText.value = false; } }, ); // Translate when requested?