Skip to content
0

壁纸api需求-cache

解决思路

方案1-php脚本

方案2-nginx+lua

image-20250910065932039

image-20250910065951497

image-20250910202231194

image-20250910202340590


D:\BaiduSyncdisk\other\壁纸api\v0-nginx-lua脚本-威威-2025.9.10

image-20250910202527606

方案3-freersync

image-20250910202207243

teek目前壁纸存在的问题-壁纸获取感觉有缓存

2025年9月10日

image-20250910193624725


image-20250910202840919

开发思路

image-20250910202634046

image-20250910202652819


image-20250910202725025

image-20250910202744480

Teeker回复

image-20250910202949216

image-20250910203031793

image-20250910203102872

威威大佬

image-20250912061914246

image-20250912061939239

XGQ大佬--实现了??

看效果 的确是实现了的

image-20250912062021750

image-20250912062102155

vue
const fallbackImages =[]
// 动态获取图片列表的函数
async function fetchDynamicWallpapers(): Promise<string[]> {
  try {
    // 使用你的本地图片服务API
    const response = await fetch("http://localhost:9999/api/images", {
      method: 'GET',
      headers: {
        'Accept': 'application/json',
      },
    });
    
    if (!response.ok) {
      throw new Error(`HTTP ${response.status}: ${response.statusText}`);
    }
    
    const data = await response.json();
    const images = data.images || [];
    
    // 将相对路径转换为完整的localhost URL
    const wallpapers = images.map((imagePath: string) => `http://localhost:9999${imagePath}`);
    
    // 如果获取到图片,返回动态图片列表,否则返回备用图片
    return wallpapers.length > 0 ? wallpapers : fallbackImages;
    
  } catch (error) {
    console.warn('无法获取动态壁纸,使用备用图片:', error);
    return fallbackImages;
  }
}

// 创建一个Promise来获取壁纸
let wallpaperPromise: Promise<string[]> | null = null;

// 获取壁纸的函数
function getWallpapers(): Promise<string[]> {
  if (!wallpaperPromise) {
    wallpaperPromise = fetchDynamicWallpapers();
  }
  return wallpaperPromise;
}

// 导出的Wallpaper数组 - 在服务端渲染时使用备用图片,客户端动态加载
export const Wallpaper = fallbackImages;

// 导出动态获取函数供主题使用
export { getWallpapers, fetchDynamicWallpapers };

image-20250912062202728

image-20250912062324606

image-20250912062358054

边缘函数也可以开

image-20250913081220757

image-20250913081920736

image-20250913081934421

image-20250913082002426

目前已实现部分功能的方案

v1-2025.9.8-白木大佬发的那个已实现部分功能版本(部署失败😢)

📌存在问题

此版本存在的问题:

  1. 不支持webp格式
  2. 不能间隔8s后刷新 (目前是手动刷新后会切换一次)
  3. 接入teek是有效果的
  4. 部署存在问题
  5. 浏览器出现的图片两边是黑框

📌源码位置

D:\BaiduSyncdisk\other\壁纸api\v1-2025.9.8-白木大佬发的那个已实现部分功能版本

image-20250910062454762


📌讨论过程

php的图片api源码:https://baimu.live/258

image-20250908153449652

image-20250908153534679

image-20250908153618371

就是链接本地图片路径 例如: avatar: https://gcore.jsdelivr.net/gh/Kele-Bingtang/static/user/20211029181901.png

改为 avatar: https://baimu.live/api/tp/LycorisRecoil/LycorisRecoil.php

image-20250908153637638

image-20250908153721517

📌部署方法(失败)

image-20250908153758494

image-20250908153809009

image-20250908153822737

image-20250908153831472

v2-2025.9.9-nas大佬发的那个已实现部分功能版本(不支持随机😢)

📌存在问题

此版本存在的问题:

  1. 不支持webp格式
  2. 不能间隔8s后刷新 (目前是手动刷新后会切换一次)
  3. 接入teek是有效果的 (待测试)
  4. 部署是可以成功的👏
  5. 浏览器出现的图片两边是黑框

📌源码位置

D:\BaiduSyncdisk\other\壁纸api\v2-2025.9.9-nas大佬发的那个已实现部分功能版本

image-20250910062907238

📌部署方法

  1. 云服务器配置好Nginx https://onedayxyy.cn/linux/yum-install-nginx
  2. 云服务器配置好php8.2环境 https://onedayxyy.cn/qianduan/php-install-8-2

image-20250910065648923

image-20250910065630076

v3-2025.9.9-One 基于nas大佬 二开的那个已实现部分功能版本(不支持随机😢)

📌效果预览

https://imgapi.onedayxyy.cn/

image-20250910063435621

📌存在问题

此版本存在的问题:

  1. 不能间隔8s后刷新 (目前是手动刷新后会切换一次)
  2. 接入teek是有效果的
  3. 部署是可以成功的👏
  4. 浏览器出现的图片两边是黑框

📌源码位置

D:\BaiduSyncdisk\other\壁纸api\v3-2025.9.9-One 基于nas大佬 二开的那个已实现部分功能版本

image-20250910063351288

📌部署方法

  1. 云服务器配置好Nginx https://onedayxyy.cn/linux/yum-install-nginx
  2. 云服务器配置好php8.2环境 https://onedayxyy.cn/qianduan/php-install-8-2

image-20250910065648923

image-20250910065630076

v4-2025.9.11-白木大佬发的go项目 壁纸api(测试成功,随机壁纸api本身功能可以,但teek无法正常显示)

v1(随机壁纸api本身功能可以,但teek无法正常显示)

📌存在问题

具备功能:

  1. 可以间隔8s后刷新,同时手动刷新后也会切壁纸
  2. 部署是可以成功的👏
  3. 浏览器2边没黑框
  4. 图片尺寸自适应浏览器
  5. webp和其他类型都支持
  6. 图片目录可以随时增加或减少图片,也不用修改代码

此版本存在的问题:

  1. 但接入teek 没效果的
  2. 不能自定义运行端口

image-20250912055649447

📌源码位置

D:\BaiduSyncdisk\other\壁纸api\v4-2025.9.11-白木大佬发的go项目 壁纸api\v1-第一次版本

image-20250912055338184

📌部署方法
  1. 安装go环境
  2. 二进制运行

问题1:这个服务器前台一直有log弹出,但是我往日志文件里已经写了啊。。。

bash
[root@wiki goimgapi]# pwd
/images/goimgapi
[root@wiki goimgapi]# ls
goimgapi.log  images  main  main.exe  templates

chmod +x main

[root@wiki goimgapi]# ./main > goimgapi.log &

image-20250912055420720

问题2:这个go程序不能自定义运行端口

v2(随机壁纸api本身功能可以,但teek无法正常显示)

📌存在问题

具备功能:

  1. 可以间隔8s后刷新,同时手动刷新后也会切壁纸
  2. 部署是可以成功的👏
  3. 浏览器2边没黑框
  4. 图片尺寸自适应浏览器
  5. webp和其他类型都支持
  6. 图片目录可以随时增加或减少图片,也不用修改代码

此版本存在的问题:

  1. 但接入teek 没效果的

image-20250912055649447

📌源码位置

D:\BaiduSyncdisk\other\壁纸api\v4-2025.9.11-白木大佬发的go项目 壁纸api\v2-包含源码

image-20250912061124306

📌部署方法
  1. 安装go环境
  2. 二进制运行

问题1:这个服务器前台一直有log弹出,但是我往日志文件里已经写了啊。。。

bash
[root@wiki goimgapi]# pwd
/images/goimgapi
[root@wiki goimgapi]# ls
goimgapi.log  images  main  main.exe  templates
[root@wiki goimgapi]# ./main > goimgapi.log &

image-20250912055420720


image-20250912061142460

image-20250912061206518

v5-2025.9.12-XGQ-go项目

注意事项

image-20250913080651196

image-20250913080719725

image-20250913080737867

image-20250913080757398

它返回的是一个网站哦

image-20250913081340550

image-20250913081405909

image-20250913081434892

继续讨论

image-20250913081553260

威威大佬

image-20250913081654929

image-20250913081730686

image-20250913081754990

威威出手

image-20250913082115842

image-20250913082139065

image-20250913082153597

最近更新