Skip to content

Commit

Permalink
V0.4.4 全新音乐播放器上线(QQ音乐、网易云音乐),由于特殊原因暂不支持vip歌曲,新增首页天气控件开关,位置自定义开关,时间格式自定义
Browse files Browse the repository at this point in the history
  • Loading branch information
RandallAnjie committed Jun 6, 2024
1 parent 8b4a5dc commit 2825af6
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ENV REDIS_HOST=redis
ENV REDIS_PORT=6379
ENV REDIS_PASSWORD=
ENV REDIS_DATABASE=0
RUN npx prisma migrate dev --name v0_4_2
RUN npx prisma migrate dev --name v0_4_4
RUN npm run build
RUN chmod +x /app/start.sh
EXPOSE 3000
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile_with_redis
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ENV REDIS_HOST=127.0.0.1
ENV REDIS_PORT=6379
ENV REDIS_PASSWORD=
ENV REDIS_DATABASE=0
RUN npx prisma migrate dev --name v0_4_2
RUN npx prisma migrate dev --name v0_4_4
RUN npm run build
RUN rm -rf /app/data/db.sqlite
RUN apt install redis-server -y
Expand Down
18 changes: 15 additions & 3 deletions components/FriendsMemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@
</div>
<div class="text-[#576b95] font-medium dark:text-white text-xs mt-1 mb-1 select-none">{{props.memo.location?.split(/\s+/g).join(' · ')}}</div>
<div class="toolbar relative flex flex-row justify-between select-none my-1">
<div class="flex-1 text-gray text-xs text-[#9DA4B0] ">{{
dayjs(props.memo.createdAt).locale('zh-cn').fromNow().replaceAll(/\s+/g,
'') }}</div>
<div class="flex-1 text-gray text-xs text-[#9DA4B0] ">{{ timeFormateFunction(props.memo.createdAt) }}</div>
<div @click="showToolbar = !showToolbar"
class="toolbar-icon mb-2 px-2 py-1 bg-[#f7f7f7] dark:bg-slate-700 hover:bg-[#dedede] cursor-pointer rounded flex items-center justify-center">
<img src="~/assets/img/dian.svg" class="w-3 h-3" />
Expand Down Expand Up @@ -257,6 +255,13 @@ const copyShare = (path: string) => {
});
};
const timeFormateFunction = (time: string) => {
if(timeFrontend && timeFrontend.value !== ''){
return dayjs(time).locale('zh-cn').format(timeFrontend.value)
}else{
return dayjs(time).locale('zh-cn').fromNow().replaceAll(/\s+/g, '')
}
}
const refreshAtpeople = async ()=>{
if(props.memo.atpeople?.split(',')){
atpeoplenickname.value = ''
Expand Down Expand Up @@ -288,6 +293,8 @@ onClickOutside(toolbarRef, () => {
showToolbar.value = false
})
const timeFrontend = ref('')
onMounted(async () => {
if (token) {
userId = useCookie('userId')
Expand All @@ -299,6 +306,11 @@ onMounted(async () => {
})
}
})
await $fetch('/api/user/settings/get').then((res) => {
if (res.success) {
timeFrontend.value = res.data.timeFrontend
}
})
})
const gridCols = computed(() => {
Expand Down
46 changes: 27 additions & 19 deletions components/HeaderImg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,26 @@
/>
</div>
<div class="flex flex-row items-center gap-4 justify-end">
<iframe
scrolling="no"
src="https://widget.tianqiapi.com/?style=tz&skin=pitaya&color=000"
frameborder="0"
width="200"
height="20"
allowtransparency="true"
v-if="colorMode.value === 'light'"
></iframe>
<iframe
scrolling="no"
src="https://widget.tianqiapi.com/?style=tz&skin=pitaya&color=fff"
frameborder="0"
width="200"
height="20"
allowtransparency="true"
v-if="colorMode.value === 'dark'"
></iframe>
<div v-if="shwoWeather">
<iframe
scrolling="no"
src="https://widget.tianqiapi.com/?style=tz&skin=pitaya&color=000"
frameborder="0"
width="200"
height="20"
allowtransparency="true"
v-if="colorMode.value === 'light'"
></iframe>
<iframe
scrolling="no"
src="https://widget.tianqiapi.com/?style=tz&skin=pitaya&color=fff"
frameborder="0"
width="200"
height="20"
allowtransparency="true"
v-if="colorMode.value === 'dark'"
></iframe>
</div>
<div
:key="user.headImgKey"
class="slogon text-gray truncate w-full text-end text-xs mt-2"
Expand Down Expand Up @@ -77,13 +79,19 @@ async function fetchUserData(id: any) {
user.headImgKey++; // Force re-render by changing key
}
}
const shwoWeather = ref(false)
onMounted(async () => {
const url = window.location.pathname;
if (url.startsWith('/user/')) {
findId = url.split('/user/')[1];
}
await fetchUserData(findId);
await $fetch('/api/user/settings/get').then((res) => {
if (res.success) {
shwoWeather.value = (res.data.customWeather == "1")
}
})
});
settingsUpdateEvent.on(async () => {
Expand Down
16 changes: 15 additions & 1 deletion components/MemoInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@
</PopoverTrigger>
<PopoverContent class="w-auto">
<div class="flex flex-row gap-2 text-sm">
<Input
v-model="locationInfo"
class="w-full"
placeholder="请输入位置信息"
v-if="showLocationInput"
/>
<Button variant="outline" @click="updateLocation">自动获取</Button>
<Button variant="outline" @click="locationInfo = ''">清空</Button>
</div>
Expand Down Expand Up @@ -334,6 +340,7 @@ import {
ComboboxViewport
} from "radix-vue";
import {memo} from "@tanstack/virtual-core";
import { useState, useAsyncData } from '#imports';
const locationInfo = ref('');
const inputs0 = ref('');
const inputs1 = ref('');
Expand Down Expand Up @@ -672,7 +679,14 @@ memoUpdateEvent.on((event: Memo) => {
music163Open.value = false
musicBoxKey++
})
const showLocationInput = ref(false)
onMounted(async () => {
await $fetch('/api/user/settings/get').then((res) => {
if (res.success) {
showLocationInput.value = (res.data.customLocation == "1")
}
})
})
const getTmpLocation = async () => {
return new Promise(async (resolve, reject) => {
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
volumes:
- ./redis:/data
app:
image: ranjie/rmoments:v0.4.2
image: ranjie/rmoments:latest
restart: always
#env_file: .env
networks:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose_with_redis.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
app:
image: ranjie/rmoments:v0.4.2_with_redis # 记得检查镜像版本
image: ranjie/rmoments:latest_with_redis # 记得检查镜像版本
restart: always
ports:
- "3000:3000"
Expand Down
2 changes: 2 additions & 0 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ onMounted(async () => {
}
const response = await $fetch('/api/user/settings/get?user=' + (findId == 'undefined' ? '0' : findId));
const { data: res } = await useAsyncData('userinfo', async () => response);
// 将response存储systemConfig中
await useAsyncData('systemConfig', async () => response)
if(res.value?.data.enableRegister){
canRegister.value = true
}
Expand Down
4 changes: 3 additions & 1 deletion pages/about.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div>
</div>
<div id="version-info">
当前版本: <span id="version">V0.4.3</span>
当前版本: <span id="version">V0.4.4</span>
<div class="update-details">
更新日志:
<br/>
Expand Down Expand Up @@ -73,6 +73,8 @@
·V0.4.2 2024-05-28 图片放大查看时隐藏菜单按钮,修复切换页面时头图不切换的bug,修复fancybox在新插入文章的时候刷新机制出现问题,修复docker启动时不检查upload文件夹是否存在
<br/>
·V0.4.3 2024-06-03 新增几个快捷标签,新增部分后台自定义选项,新增邮件模板,新增code样式点击可复制,新增个人页面css,个人js依旧不能自定义
<br/>
·V0.4.4 2024-06-06 全新音乐播放器上线(QQ音乐、网易云音乐),由于特殊原因暂不支持vip歌曲,新增首页天气控件开关,位置自定义开关,时间格式自定义
</div>
<div onclick="window.open('https://randallanjie.com/', '_blank');">Powered By Randall</div>
</div>
Expand Down
11 changes: 9 additions & 2 deletions pages/config.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@
</div>

<div class="flex flex-col gap-2 qus-box">
<Label for="customLocation" class="font-bold">启用首页天气展示</Label>
<Label for="customWeather" class="font-bold">启用首页天气展示</Label>
<Switch id="customWeather" v-model:checked="state.customWeather" />
</div>

<div class="flex flex-col gap-2 qus-box">
<Label for="customLocation" class="font-bold">启用自定义位置</Label>
<Switch id="customLocation" v-model:checked="state.customLocation" />
</div>

Expand Down Expand Up @@ -403,7 +408,8 @@ const state = reactive({
emailNewCommentNotification: '',
emailNewReplyCommentNotification: '',
emailNewMentionCommentNotification: '',
metingApi: ''
metingApi: '',
customWeather: false
})
const { data: res } = await useFetch<{ data: typeof state }>('/api/site/config/get',{key:'settings'})
Expand Down Expand Up @@ -452,6 +458,7 @@ state.emailNewCommentNotification = data?.emailNewCommentNotification || ''
state.emailNewReplyCommentNotification = data?.emailNewReplyCommentNotification || ''
state.emailNewMentionCommentNotification = data?.emailNewMentionCommentNotification || ''
state.metingApi = data?.metingApi || ''
state.customWeather = data.customWeather ? data.customWeather == "1" : false
const uploadImgs = async (event: Event, id: string) => {
Expand Down
2 changes: 2 additions & 0 deletions server/api/site/config/save.post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type SaveConfigsReq = {
emailNewReplyCommentNotification?: string,
emailNewMentionCommentNotification?: string,
metingApi?: string,
customWeather?: boolean,
};

export default defineEventHandler(async (event) => {
Expand Down Expand Up @@ -135,6 +136,7 @@ export default defineEventHandler(async (event) => {
await updateSystemConfig("emailNewReplyCommentNotification", data.emailNewReplyCommentNotification||"");
await updateSystemConfig("emailNewMentionCommentNotification", data.emailNewMentionCommentNotification||"");
await updateSystemConfig("metingApi", data.metingApi||"");
await updateSystemConfig("customWeather", data.customWeather?'1':'0');

return {
success: true,
Expand Down

0 comments on commit 2825af6

Please sign in to comment.