first commit

This commit is contained in:
编码猿
2024-09-27 01:07:59 +08:00
commit 6cd216628a
162 changed files with 21879 additions and 0 deletions

0
static/.gitkeep Executable file
View File

1
static/.pydio Normal file
View File

@@ -0,0 +1 @@
7a7ee140-be3d-4444-997d-b64d2ad35cdf

View File

@@ -0,0 +1 @@
8a6de9b1-1eaf-4085-a169-21a53b3ec064

BIN
static/build-icons/icon.icns Executable file

Binary file not shown.

BIN
static/build-icons/icon.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

1
static/iconfont/.pydio Normal file
View File

@@ -0,0 +1 @@
cb5c168f-4946-49ce-8569-2940886485b0

113
static/iconfont/iconfont.css Executable file

File diff suppressed because one or more lines are too long

BIN
static/iconfont/iconfont.eot Executable file

Binary file not shown.

177
static/iconfont/iconfont.json Executable file
View File

@@ -0,0 +1,177 @@
{
"id": "",
"name": "",
"font_family": "iconfont",
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "49953121",
"name": "全屏",
"font_class": "quanping",
"unicode": "e600",
"unicode_decimal": 58880
},
{
"icon_id": "31571263",
"name": "返回",
"font_class": "back",
"unicode": "e617",
"unicode_decimal": 58903
},
{
"icon_id": "49962969",
"name": "back",
"font_class": "back1",
"unicode": "e602",
"unicode_decimal": 58882
},
{
"icon_id": "31613524",
"name": "加载",
"font_class": "jiazai",
"unicode": "e795",
"unicode_decimal": 59285
},
{
"icon_id": "31612859",
"name": "loading",
"font_class": "loading",
"unicode": "e627",
"unicode_decimal": 58919
},
{
"icon_id": "49955354",
"name": "image",
"font_class": "heng-ping",
"unicode": "e605",
"unicode_decimal": 58885
},
{
"icon_id": "31571264",
"name": "下载",
"font_class": "xiazai",
"unicode": "e640",
"unicode_decimal": 58944
},
{
"icon_id": "31571265",
"name": "文件夹",
"font_class": "wenjianjia",
"unicode": "e642",
"unicode_decimal": 58946
},
{
"icon_id": "32280807",
"name": "刷新",
"font_class": "shuaxin",
"unicode": "e61d",
"unicode_decimal": 58909
},
{
"icon_id": "31873093",
"name": "版本",
"font_class": "banben",
"unicode": "e60a",
"unicode_decimal": 58890
},
{
"icon_id": "31571266",
"name": "设置",
"font_class": "shezhi",
"unicode": "e63b",
"unicode_decimal": 58939
},
{
"icon_id": "31610912",
"name": "退出",
"font_class": "tuichu",
"unicode": "e658",
"unicode_decimal": 58968
},
{
"icon_id": "49962972",
"name": "关闭",
"font_class": "close",
"unicode": "e609",
"unicode_decimal": 58889
},
{
"icon_id": "31713894",
"name": "图标_草莓",
"font_class": "tubiao_caomei",
"unicode": "e60d",
"unicode_decimal": 58893
},
{
"icon_id": "31873094",
"name": "版本",
"font_class": "banben1",
"unicode": "e604",
"unicode_decimal": 58884
},
{
"icon_id": "31610895",
"name": "搜索",
"font_class": "sousuo",
"unicode": "e679",
"unicode_decimal": 59001
},
{
"icon_id": "50169425",
"name": "公告",
"font_class": "gonggao",
"unicode": "e620",
"unicode_decimal": 58912
},
{
"icon_id": "31610935",
"name": "版本号",
"font_class": "banbenhao",
"unicode": "e672",
"unicode_decimal": 58994
},
{
"icon_id": "31873095",
"name": "版本",
"font_class": "banben2",
"unicode": "ea34",
"unicode_decimal": 59956
},
{
"icon_id": "49962973",
"name": "刷新",
"font_class": "research",
"unicode": "e6a8",
"unicode_decimal": 59048
},
{
"icon_id": "31873096",
"name": "版本",
"font_class": "zhuyishixiang",
"unicode": "e601",
"unicode_decimal": 58881
},
{
"icon_id": "31571267",
"name": "显示器",
"font_class": "xianshiqi",
"unicode": "e6c1",
"unicode_decimal": 59073
},
{
"icon_id": "49956937",
"name": "image",
"font_class": "su-ping",
"unicode": "e61c",
"unicode_decimal": 58908
},
{
"icon_id": "49963184",
"name": "back",
"font_class": "forwad",
"unicode": "ea35",
"unicode_decimal": 59957
}
]
}

98
static/iconfont/iconfont.svg Executable file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 34 KiB

BIN
static/iconfont/iconfont.ttf Executable file

Binary file not shown.

BIN
static/iconfont/iconfont.woff Executable file

Binary file not shown.

BIN
static/iconfont/iconfont.woff2 Executable file

Binary file not shown.

1
static/img/.pydio Normal file
View File

@@ -0,0 +1 @@
535ba2d1-4d03-4940-ba1a-d40f1a5b1433

BIN
static/img/banben.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
static/img/tray.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
static/img/trayTemplate.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B

BIN
static/img/trayTemplate@2x.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
static/img/trayTemplate@3x.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1 @@
9ee1ce08-fc01-4056-82ff-1b02b4bc49ab

128
static/page-script/500px.js Executable file
View File

@@ -0,0 +1,128 @@
const { ipcRenderer } = require('electron')
const axios = require('axios')
const { render } = require('./render')
const apiAddress = 'https://api.500px.com/v1/photos'
const getDownloadUrl = id => new Promise((resolve, reject) => {
axios.get(apiAddress, {
params: {
image_size: [1600, 2048, 2500, 3000, 4096, 4500, 5120, 5500, 6144, 7168],
ids: id,
},
responseType: 'json',
headers: {
Accept: 'application/json',
}
}).then((res) => {
if (res.status === 200){
const { photos } = res.data
const imageInfo = photos[id]
let maxSize = 0
let downloadUrl = ''
for (let i = 0; i < imageInfo.image_url.length; i++) {
const imagePath = imageInfo.image_url[i]
const realSize = imagePath.match(/m%3D(\d*)/)
if (realSize && realSize[1]){
const size = parseInt(realSize[1], 10)
if (size > maxSize) {
downloadUrl = imagePath
}
maxSize = size
}
}
resolve(downloadUrl)
} else {
reject()
}
}).catch(() => {
reject()
})
})
const isImg = target => (target.tagName === 'A' && target.parentNode.className.includes('photo_thumbnail'))
|| (target.tagName === 'IMG' && target.className === 'photo-show__img')
const mouseoverFn = function (e){
const { target } = e
if (isImg(target)){
const { parentNode } = target
if (!parentNode.addChild){
let href = ''
if (target.tagName === 'A'){
href = target.getAttribute('href')
}
else if (target.tagName === 'IMG'){
href = target.getAttribute('src')
}
const idMatches = href.match(/photo\/(\d*)\//)
let id = ''
if (idMatches && idMatches[1]){
[, id] = idMatches
}
const downloadFile = function (event){
event.stopPropagation()
event.preventDefault()
ipcRenderer.sendToHost('notify', {
type: 'info',
title: '提示',
message: '正在解析下载地址,请等待...'
})
getDownloadUrl(id).then((res) => {
ipcRenderer.sendToHost('download', { downloadUrl: res })
})
}
const setWallpaper = function (event){
event.stopPropagation()
event.preventDefault()
ipcRenderer.sendToHost('notify', {
type: 'info',
title: '提示',
message: '正在解析下载地址,请等待...'
})
getDownloadUrl(id).then((res) => {
ipcRenderer.sendToHost('setWallpaper', { downloadUrl: res })
})
}
const options = {
downloadFile,
setWallpaper,
}
parentNode.addChild = render(options)
if (target.tagName === 'IMG'){
parentNode.addChild.style.left = '50%'
parentNode.addChild.style.top = '50%'
}
else {
parentNode.addChild.style.left = 0
}
parentNode.appendChild(parentNode.addChild)
}
}
}
const mouseoutFn = function (e){
const { target } = e
if (isImg(target)){
const { parentNode } = target
if (parentNode.addChild){
window.setTimeout(() => {
if (!parentNode.addChild.mouseoverFlag){
parentNode.removeChild(parentNode.addChild)
parentNode.addChild = null
}
}, 50)
}
}
}
ipcRenderer.on('dom-ready', () => {
console.log('================500px-load')
document.querySelector('body').addEventListener('mouseover', mouseoverFn, false)
document.querySelector('body').addEventListener('mouseout', mouseoutFn, false)
})

48
static/page-script/nasa.js Executable file
View File

@@ -0,0 +1,48 @@
const { ipcRenderer } = require('electron')
const { render } = require('./render')
const PUBLICURL = '/sites/default/files/styles/image_card_4x3_ratio/public/'
const DOWNLOADPUBLICURL = '/sites/default/files/'
const isImg = target => target.tagName === 'IMG' && target.parentNode.className === 'image'
const mouseoverFn = function (e){
const { target } = e
if (isImg(target)){
const { parentNode } = target
window.setTimeout(() => {
if (!parentNode.addChild){
const src = target.getAttribute('src')
const options = {
width: 0,
height: 0,
url: src,
downloadUrl: `https://www.nasa.gov${src.replace(PUBLICURL, DOWNLOADPUBLICURL)}`
}
parentNode.addChild = render(options)
parentNode.appendChild(parentNode.addChild)
}
}, 80)
}
}
const mouseoutFn = function (e){
const { target } = e
if (isImg(target)){
const { parentNode } = target
if (parentNode.addChild){
window.setTimeout(() => {
if (!parentNode.addChild.mouseoverFlag){
parentNode.removeChild(parentNode.addChild)
parentNode.addChild = null
}
}, 80)
}
}
}
ipcRenderer.on('dom-ready', () => {
console.log('================nasa-load')
document.querySelector('body').addEventListener('mouseover', mouseoverFn, false)
document.querySelector('body').addEventListener('mouseout', mouseoutFn, false)
})

40
static/page-script/pexels.js Executable file
View File

@@ -0,0 +1,40 @@
const { ipcRenderer } = require('electron')
const { render } = require('./render')
const isImg = target => target.tagName === 'IMG' && ['photo-item__img'].includes(target.className)
const mouseoverFn = function (e){
const { target } = e
if (isImg(target)){
const imgParent = target.parentNode
if (!imgParent.addChild){
const options = {
width: target.getAttribute('data-image-width'),
height: target.getAttribute('data-image-height'),
url: target.getAttribute('data-large-src'),
downloadUrl: target.getAttribute('data-big-src').split('?')[0]
}
imgParent.addChild = render(options)
imgParent.appendChild(imgParent.addChild)
}
}
}
const mouseoutFn = function (e){
const { target } = e
if (isImg(target)){
const imgParent = target.parentNode
if (imgParent.addChild){
window.setTimeout(() => {
if (!imgParent.addChild.mouseoverFlag){
imgParent.removeChild(imgParent.addChild)
imgParent.addChild = null
}
}, 40)
}
}
}
ipcRenderer.on('dom-ready', () => {
document.querySelector('body').addEventListener('mouseover', mouseoverFn, false)
document.querySelector('body').addEventListener('mouseout', mouseoutFn, false)
})

98
static/page-script/render.js Executable file
View File

@@ -0,0 +1,98 @@
/* eslint-disable max-len */
const { ipcRenderer } = require('electron')
const iconDownload = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABS0lEQVQ4T72TsU7DMBCGfU6y8gzMPAFMLQMbYqpjRQoLAwtiYIWhzcATsDExRIpsZ0SslAkeg2dgjeNDjmIprZLWkQJeklj2d3/++w/IxAsm5hEvoFKK2cKMMbVPgBdQCLGyIM5589y1/haY5/lBFEUnlNJjrfVHkiRrq2ZbYVEU8zAMZ8aYr6qqPtM0/XGqNxTai5TShTGmNMasdwEppXN3tmvFBlAp9a61zhzIVVVKLdumZF3/WqVLxthpr8Ih4FBTpJQXAHDnBbTVgyB4ruv62vplFVhf3Z79CynlJQBceQFdMwDgAREf7bd7d56VZXmDiAtvYAfaeIiIWbcBQoh7SunZKGBfbFwD2lTMRgOHJuP/gUIICQBvcRy/7JvZjhVHnPN4KIfniPhECDn0ARJCvgHgljH22gt0mzaDPsDtiWqi5XNxzJnJgb8whuUV13+BlgAAAABJRU5ErkJggg=='
const iconDownloadHover = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABF0lEQVQ4T72TMU4DMRBF378AZ6DmBFAFCjpEBeloKGhQClooQgpOQEdFDSkRLUkFx+AMucBHtryRE+1ir7QwjS3LfvP9Z0YMHBqYRxXQ9nlILOm1JKAWeJ+Acf0t/hZoewc4APaBpaRFUGN7Q6HtQ2AEfAGfklaN6g2F6eEZMAcWBWCAxruS1lZsAz+AWQNqstqeJg9nuX9J6VTSUZfCLmBrUWyfAjdVwJT9CbhKfgURSyCehV/YvgAuq4BZMe6Ah/SluG88s30dfKwGZtDoYfJ3XQDbt8BxL2Bb22TFCvBRb2DXZKQ2+1/gC/Au6bk0s5kVe5LGXX14AjwCuzVA4BuYSHprBWZmh7EqxvZExWkqvup5YXDgD/V/oxUurSvtAAAAAElFTkSuQmCC'
const iconWallpaper = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABQ0lEQVQ4T7XUsUrDUBQG4P8k6eZj6FJfQai4ueeeSzcfQVwVSsEn8Ams4JATcHDQsYrgAzi4uLgKoiCOjb/c1pQaLG1DvEvIublf/tyTRNDwkIY9TME8z3sAtmdvQPKFZCQiMYCIZCwiEYDxMZyHOoA7VQ3rJ6CZ7QHoiciRc+58ldRmtg7gOoqi4zRNByV4CeBCVU9Xwcpr8zzfJXmlqlKCw6Io+t1u96YOGNZkWfbovW83CX5679caA82MjT7y/4Micuicu6/blD8T1sXCujiOh7/2UCZvUO1BMjRlZ6xkWXYiIl+qul9HNLMzkq/e+4NpLDN7AvBM8n0VVEQ+AHRUdWP6LZeAmW0VRZFUwSRJOqE2Go1uq3OtVustTdOHsr7Uxv38ieCc6y9KPxc0s7aIGMnNKhK6OQ9eKuGiVLPzjYPfQXGrFUxePR0AAAAASUVORK5CYII='
const iconWallpaperHover = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAA/UlEQVQ4T7XUMUrEQBSH8e9TS4+hzXoFYcXOW3iExVZBFjyBJ1DBxsLCQstdETyAhY2NrSAKYu2TYGYJMZJNdpwm8Cbzm38yvJHMw8weMzAiDoGt2gYvwBKw3PK8U4v1P2BE7AJF4UA975I6ItaAG+BIPU3gFXCpnnTB0rsRsQNcW4wy4QQYq9M+YGk8qoOc4Ke6mhOM3J/8/+C+er/AofxO2Bcr103q/3BBjyLhdjrlY+BLHfVRI+IMeFX3qr38BDwD7x3RD2Cors96udJCm8BKAzgsa7cNc2/qQ6rPdX2VNxHquC39n2BEDIALYKOOpDugCZ8rYVuq6nx28BvGs3gV89CM0AAAAABJRU5ErkJggg=='
const render = (options) => {
const downloadFile = function (e){
e.stopPropagation()
e.preventDefault()
ipcRenderer.sendToHost('notify', {
type: 'info',
title: '提示',
message: '正在准备,请等待...'
})
ipcRenderer.sendToHost('download', { ...options })
}
const setWallpaper = function (e){
e.stopPropagation()
e.preventDefault()
ipcRenderer.sendToHost('notify', {
type: 'info',
title: '提示',
message: '正在准备,请等待...'
})
ipcRenderer.sendToHost('setWallpaper', { ...options })
}
const btnMouseOver = function (e, icon){
const { target } = e
target.style.color = '#ffffff'
target.style.background = `url(${icon}) no-repeat center center`
}
const btnMouseLeave = function (e, icon){
const { target } = e
target.style.color = '#bbbbbb'
target.style.background = `url(${icon}) no-repeat center center`
}
const dom = document.createElement('div')
const btnDownload = document.createElement('div')
btnDownload.setAttribute('title', '点击下载')
const btnWallpaper = document.createElement('div')
btnWallpaper.setAttribute('title', '设置壁纸')
const btnCssText = 'width:50px;height:100%;color:#bbb;cursor:default;font-size:20px;'
btnDownload.style.cssText = btnCssText
btnWallpaper.style.cssText = btnCssText
dom.style.cssText = 'display:flex; position:absolute;z-index:1; right:0;top:0; align-items:center; width:100px;height:40px;background-color:#222;'
btnDownload.onclick = null
btnDownload.onclick = options.downloadFile || downloadFile
btnDownload.onmouseover = (e) => { btnMouseOver(e, iconDownloadHover) }
btnDownload.onmouseleave = (e) => { btnMouseLeave(e, iconDownload) }
btnWallpaper.onclick = null
btnWallpaper.onclick = options.setWallpaper || setWallpaper
btnWallpaper.onmouseover = (e) => { btnMouseOver(e, iconWallpaperHover) }
btnWallpaper.onmouseleave = (e) => { btnMouseLeave(e, iconWallpaper) }
dom.appendChild(btnDownload)
dom.appendChild(btnWallpaper)
btnDownload.style.background = `url(${iconDownload}) no-repeat center center`
btnWallpaper.style.background = `url(${iconWallpaper}) no-repeat center center`
dom.className = 'wallpaper-ctrl'
dom.onmouseover = function (e){
e.stopPropagation()
e.preventDefault()
dom.mouseoverFlag = true
return false
}
dom.onmouseout = function (e){
e.stopPropagation()
e.preventDefault()
dom.mouseoverFlag = false
return false
}
return dom
}
module.exports = {
render
}

View File

@@ -0,0 +1,43 @@
const { ipcRenderer } = require('electron')
const { render } = require('./render')
const isImg = target => target.tagName === 'IMG' && target.parentNode.tagName === 'A' && target.parentNode.parentNode.className === 'image_content'
const mouseoverFn = function (e){
const { target } = e
if (isImg(target)){
const { parentNode } = target.parentNode
if (!parentNode.addChild){
const src = target.parentNode.getAttribute('href')
const options = {
width: 0,
height: 0,
url: src,
downloadUrl: src,
}
parentNode.addChild = render(options)
parentNode.appendChild(parentNode.addChild)
}
}
}
const mouseoutFn = function (e){
const { target } = e
if (isImg(target)){
const { parentNode } = target.parentNode
if (parentNode.addChild){
window.setTimeout(() => {
if (!parentNode.addChild.mouseoverFlag){
parentNode.removeChild(parentNode.addChild)
parentNode.addChild = null
}
}, 50)
}
}
}
ipcRenderer.on('dom-ready', () => {
console.log('================them-load')
document.querySelector('body').addEventListener('mouseover', mouseoverFn, false)
document.querySelector('body').addEventListener('mouseout', mouseoutFn, false)
})

45
static/page-script/unsplash.js Executable file
View File

@@ -0,0 +1,45 @@
const { ipcRenderer } = require('electron')
const { render } = require('./render')
const isImg = target => target.tagName === 'IMG' && target.getAttribute('srcset')
const mouseoverFn = function (e){
const { target } = e
if (isImg(target)){
const { parentNode } = target
if (!parentNode.addChild){
const srcList = target.getAttribute('srcset').split(', ')
const src = srcList[srcList.length - 1]
const options = {
width: 0,
height: 0,
url: src,
downloadUrl: src.split(' ')[0].split('?')[0],
}
parentNode.addChild = render(options)
parentNode.addChild.style.left = 0
parentNode.appendChild(parentNode.addChild)
}
}
}
const mouseoutFn = function (e){
const { target } = e
if (isImg(target)){
const { parentNode } = target
if (parentNode.addChild){
window.setTimeout(() => {
if (!parentNode.addChild.mouseoverFlag){
parentNode.removeChild(parentNode.addChild)
parentNode.addChild = null
}
}, 80)
}
}
}
ipcRenderer.on('dom-ready', () => {
console.log('================un-load')
document.querySelector('body').addEventListener('mouseover', mouseoverFn, false)
document.querySelector('body').addEventListener('mouseout', mouseoutFn, false)
})

50
static/page-script/wallhaven.js Executable file
View File

@@ -0,0 +1,50 @@
const { ipcRenderer } = require('electron')
const { render } = require('./render')
const isImg = target => target.tagName === 'A' && target.parentNode.tagName === 'FIGURE'
const mouseoverFn = function (e){
const { target } = e
if (isImg(target)){
const { parentNode } = target
if (!parentNode.addChild){
const node = parentNode
const wallpaperId = node.getAttribute('data-wallpaper-id')
const url = node.querySelector('img').getAttribute('data-src')
const isPng = Boolean(node.querySelector('.png'))
const [width, height] = node.querySelector('.wall-res').innerHTML.split('x')
const downloadUrl = `https://w.wallhaven.cc/full/${wallpaperId.slice(0, 2)}/wallhaven-${wallpaperId}.${isPng ? 'png' : 'jpg'}`
const options = {
width: width.trim(),
height: height.trim(),
url,
downloadUrl,
}
parentNode.addChild = render(options)
parentNode.addChild.style.zIndex = '9999'
parentNode.appendChild(parentNode.addChild)
}
}
}
const mouseoutFn = function (e){
const { target } = e
if (isImg(target)){
const { parentNode } = target
if (parentNode.addChild){
window.setTimeout(() => {
if (!parentNode.addChild.mouseoverFlag){
parentNode.removeChild(parentNode.addChild)
parentNode.addChild = null
}
}, 80)
}
}
}
ipcRenderer.on('dom-ready', () => {
console.log('================wall-load')
document.querySelector('body').addEventListener('mouseover', mouseoverFn, false)
document.querySelector('body').addEventListener('mouseout', mouseoutFn, false)
})

306
static/tubiao_caomei.ai Executable file

File diff suppressed because one or more lines are too long