Add .dev.env & update basic logoutuser.ts & made a basic blur login

system & also normal logging in broke  :(
This commit is contained in:
吳元皓 2025-06-05 12:03:05 +08:00
parent b8438f7f33
commit 4d49554a0e
7 changed files with 85 additions and 13 deletions

29
.dev.env Normal file
View File

@ -0,0 +1,29 @@
# For prod use please use the .env.example file.
# Please use .dev.env as an starting point. Rename it to .env and fill in the values, the application needs it.
# This is the developmemnt use .env file.
# S3 INFO
S3_ACCESS_KEY=""
S3_SECRET_KEY=""
S3_BUCKETNAME=""
S3_ENDPOINT=""
# GITHUB OAUTH (NOT WORKING 4n)
NUXT_GITHUB_CLIENT_ID=""
NUXT_GITHUB_CLIENT_SECRET=""
# GLOBAL DATABASE
POSTGRES_URL=""
# GROQ API KEY
GROQ_API_KEY=""
# PASSWORD SALT
PASSWORD_HASH_SALT=""
# CF TURNSTILE
NUXT_CF_TURNSTILE_SITE_KEY=""
NUXT_CF_TURNSTILE_SECRET_KEY=""
NUXT_DEV_ENV=true

View File

@ -1,3 +1,4 @@
# For development use, please use the .dev.env file.
# Please use .env.exmaple as an starting point. Rename it to .env and fill in the values, the application needs it.
# This is the default .env file.
@ -24,3 +25,5 @@ PASSWORD_HASH_SALT=""
# CF TURNSTILE
NUXT_CF_TURNSTILE_SITE_KEY=""
NUXT_CF_TURNSTILE_SECRET_KEY=""
NUXT_DEV_ENV=false

View File

@ -8,10 +8,10 @@ App Design: [PDF Document](/design.pdf)
Reverse engineering documentation: [about](/about/)
Deploy: [via docker compose](/deploy);
Deploy: [via docker compose](/deploy.md)
## Demo:
You can try out the platform RIGHT NOW via this link: https://yhw.tw/news?goto=desktop
You can try out the app RIGHT NOW via this link: https://yhw.tw/news?goto=desktop
## 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.
@ -20,7 +20,7 @@ This code is absolutly NOT designed to be spinned up at Vercel or Netlify, it ha
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.
## news.yuanhau.com is now back up and running!
Why? Tailscale is changing the dns server to 100.100.100.100 and it just won't find the thing ghcr.io dns correctly (although ping ghcr.io works?), so I just nuked it off my server :), since I don't even use it that much. It works now. (Also deploying to zeabur hurt my wallet (it's like 0.07 for a day for the memory), as my system that I built based on ram is too costly there). oof, so please just self host it.
Why? Tailscale is changing the dns server to 100.100.100.100 and it just won't find the thing ghcr.io dns correctly (although `ping ghcr.io` works?), so I just nuked it off my server :), since I don't even use it that much. It works now. (Also deploying to zeabur hurt my wallet (it's like 0.07 for a day for the memory), as my system that I built based on ram is too costly there). oof, so please just self host it.
## Why?

View File

@ -1,6 +1,16 @@
<script setup lang="ts">
// Check if the env is in development
const addForceRefreshButtonInWindow = ref(false);
const nuxtdeven1v = process.env.NUXT_DEV_ENV?.toLowerCase() === "true";
onMounted(() => {
addForceRefreshButtonInWindow.value = nuxtdeven1v || false;
});
const forceRefresh = () => {
window.location.reload();
};
import { useThrottleFn } from "@vueuse/core";
import { XIcon, MinusIcon } from "lucide-vue-next";
import { XIcon, MinusIcon, RefreshCcwDotIcon } from "lucide-vue-next";
const props = defineProps<{
title: string;
@ -85,6 +95,13 @@ const stopDrag = () => {
{{ title }}
</h3>
<div class="flex flex-row gap-1">
<button
@click="forceRefresh"
class="p-1 hover:bg-gray-300 dark:hover:bg-gray-600 rounded transition duration-200"
v-if="addForceRefreshButtonInWindow"
>
<RefreshCcwDotIcon />
</button>
<button
@click="emit('min')"
class="p-1 hover:bg-gray-300 dark:hover:bg-gray-600 rounded transition duration-200"

View File

@ -7,7 +7,12 @@ gsap.registerPlugin(ScrambleTextPlugin);
const loading = ref(true);
const { t, locale } = useI18n();
const emit = defineEmits(["windowopener", "error", "loadValue"]);
const emit = defineEmits([
"windowopener",
"error",
"loadValue",
"openArticles",
]);
const props = defineProps({
values: {
@ -50,6 +55,10 @@ watch(
},
{ immediate: true },
);
const openNews = (url: string, titleName: string) => {
emit("openArticles", url, titleName);
};
</script>
<template>
<div>
@ -90,15 +99,22 @@ watch(
></div>
</template>
<template v-else>
<div
<hr />
<h3 class="text-2xl text-bold">文章</h3>
<button
v-for="item in fetchNewsOrgInfo?.articles"
class="p-1 bg-gray-300/70 rounded m-1"
@click="() => openNews(item.link, item.title)"
class="p-1 bg-gray-300/70 rounded min-h-4 w-full"
>
<div>
<div class="flex flex-col">
<span class="title text-bold">{{ item.title }}</span>
<span class="title text-bold texxt-sm">{{
item.title.replaceAll("獨家專欄》", "")
}}</span>
<span class="date text-xs">{{ item.date }}</span>
</div>
</div>
</button>
</template>
</div>
</div>

View File

@ -244,7 +244,7 @@ const isLoading = computed(() => contentArray.value.length === 0);
<!-- Publisher and Date Skeleton -->
<div class="flex items-center justify-center gap-2 mb-2">
<div class="h-4 w-24 bg-gray-300 animate-pulse rounded"></div>
<div class="h-4 w-4 bg-gray-300 animate-pulse rounded">--</div>
<div class="h-4 w-4 animate-pulse">--</div>
<div class="h-4 w-32 bg-gray-300 animate-pulse rounded"></div>
</div>

View File

@ -1,5 +1,5 @@
import sql from "~/server/components/postgres";
import CheckKidUnfriendlyContent from "~/components/checks/checkKidUnfriendlyContent";
import * as cheerio from "cheerio";
// Caching
@ -22,6 +22,13 @@ function cleanupCache() {
}
});
}
async function checks(title: string) {
const wordss = await pullWord();
const result = await CheckKidUnfriendlyContent(title, wordss);
checkResults.value.set(title, result);
console.log(title);
return result;
}
setInterval(cleanupCache, CACHE_DURATION);