- 按 app / shared / entities / features 分层,路由懒加载并抽出布局组件 - 请求层改为可插拔拦截器,统一错误类型、超时取消与端点拆分 - 抽取播放器、骨架屏、网格等复用组件,点赞收藏接入统一交互反馈 - 关于页重做为无边框极光风格,补充 iOS / Google Play 下载入口 - 修复播放页滚轮切集吞事件、页面误滚动、后台持续播放与声音记忆问题 - 语言按本地偏好与 IP 识别,国旗改为内联 SVG - 清理未使用的旧站点文件,补充 ESLint 配置
22 lines
611 B
JavaScript
22 lines
611 B
JavaScript
// Author: fruit.com.cn
|
|
const DEVICE_KEY = 'ymb.device.id';
|
|
|
|
function createDeviceId() {
|
|
const uuid = globalThis.crypto?.randomUUID?.() || `${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`;
|
|
return `d-${uuid}`;
|
|
}
|
|
|
|
let cachedDeviceId = '';
|
|
|
|
export function getDeviceId() {
|
|
if (cachedDeviceId) return cachedDeviceId;
|
|
try {
|
|
const stored = window.localStorage.getItem(DEVICE_KEY);
|
|
cachedDeviceId = stored || createDeviceId();
|
|
if (!stored) window.localStorage.setItem(DEVICE_KEY, cachedDeviceId);
|
|
} catch {
|
|
cachedDeviceId = createDeviceId();
|
|
}
|
|
return cachedDeviceId;
|
|
}
|