Skip to content
This repository has been archived by the owner on Aug 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #34 from Project-And-Factory/dev
Browse files Browse the repository at this point in the history
v2.4
  • Loading branch information
gozaoo committed Jul 13, 2023
2 parents c4a9b23 + 3177fbf commit ca92167
Show file tree
Hide file tree
Showing 32 changed files with 793 additions and 413 deletions.
2 changes: 1 addition & 1 deletion blurlyric/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var loadURL = 'http://localhost:18776/'
const server = await createServer({
// 任何合法的用户配置选项,加上 `mode` 和 `configFile`
configFile: path.join(__dirname, '../vite.config.js'),
root: __dirname,
root:path.join(__dirname, '../') ,
})

server.listen().then(()=>{
Expand Down
28 changes: 23 additions & 5 deletions blurlyric/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var lastTime = +new Date(),createNum = 0;
module.exports = {
getUser,
createUser,
upsetConfig
upsetConfig,
upsetPlayList
};

async function getUser(id, fun) {
Expand All @@ -18,7 +19,7 @@ async function getUser(id, fun) {
return
}
fun(dataStr)
return
return dataStr
})
}

Expand Down Expand Up @@ -48,14 +49,31 @@ async function createUser(callback) {
async function upsetConfig(query, callback) {
let file = {
id: query.id,
config: dataJson(query.res)
config: dataJson(query.res),
}


superTool.writeJson('../data/user/' + file.id + '.json', file, (err, dataStr)=>{
if (err) {
callback(err);
} else {
callback(dataStr);
}
console.log(err,dataStr);
})
}
async function upsetPlayList(query, callback) {
let file = {
playList: dataJson(query.res)
}
let origin_file
getUser(query.id, (dataStr)=>{
origin_file = dataStr
origin_file['playList'] = file.playList
})
superTool.writeJson('../data/user/' + file.id + '.json', file, (err, dataStr)=>{
if (err) {
callback(err);
} else {

callback(dataStr);
}
console.log(err,dataStr);
Expand Down
2 changes: 1 addition & 1 deletion forge.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
packageConfig: {
name: 'Blurlyric',
icon: '/src/assets/icon',
icon: 'src/assets/ico/icon',
authors: "Gozaoo"
},
makers: [
Expand Down
19 changes: 12 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// main.js

const { app, BrowserWindow, ipcMain } = require('electron')
const { app, BrowserWindow, ipcMain ,contextBridge, ipcRenderer} = require('electron')
const path = require('path')

// app.commandLine.appendSwitch('force_high_performance_gpu')
const ipc = ipcMain

var mainWindow

//登录窗口最小化
// 登录窗口最小化
ipc.on('min',function(){
mainWindow.minimize();
})
Expand All @@ -25,6 +25,7 @@ ipc.on('close',function(){
})



// 加载vite
const { createServer } = require('vite')
var loadURL = 'http://localhost:18775/'
Expand Down Expand Up @@ -57,9 +58,9 @@ const createWindow = async () => {
title: "BlurLyric",
icon:"./src/assets/icon.ico",
titleBarStyle: 'hidden',
titleBarOverlay: {
color: '#00000000',symbolColor: 'black'
},
// titleBarOverlay: {
// color: '#00000000',symbolColor: 'black'
// },
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
nodeIntegration: true,
Expand All @@ -83,8 +84,12 @@ const createWindow = async () => {
app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow()
if (BrowserWindow.getAllWindows().length === 0) {createWindow()}
})
})


app.on('ready',()=>{
app.setAboutPanelOptions({
applicationName:'BlurLyric'
})
})
10 changes: 10 additions & 0 deletions module/pl_count.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// 数字专辑-新碟上架
module.exports = (query, request) => {
const data = {}
return request('POST', `https://music.163.com/weapi/pl/count`, data, {
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
})
}
9 changes: 7 additions & 2 deletions module/song_url_v1.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
// 歌曲链接 - v1
// 此版本不再采用 br 作为音质区分的标准
// 而是采用 standard, exhigh, lossless, hires 进行音质判断
// 而是采用 standard, exhigh, lossless, hires, jyeffect(高清环绕声), sky(沉浸环绕声), jymaster(超清母带) 进行音质判断

const crypto = require('crypto')
module.exports = (query, request) => {
query.cookie.os = 'pc'
query.cookie.os = 'android'
query.cookie.appver = '8.10.05'
const data = {
ids: '[' + query.id + ']',
level: query.level,
encodeType: 'flac',
}
if (data.level == 'sky') {
data.immerseType = 'c51'
}
console.log(data)
return request(
'POST',
`https://interface.music.163.com/eapi/song/enhance/player/url/v1`,
Expand Down
72 changes: 72 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
"name": "blurlyric",
"private": true,
"main": "main.js",
"version": "2.3.1",
"version": "2.4.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"start": "electron-forge start",
"test": "electron .",
"packager": "electron-packager ./ BlurLyric --win --out ./outputs --electron-version 15.5.1 --overwrite",
"package": "electron-forge package",
"make": "electron-forge make"
},
Expand All @@ -34,6 +33,7 @@
"stackblur-canvas": "^2.5.0",
"tunnel": "^0.0.6",
"vite": "^2.9.16",
"@vitejs/plugin-vue": "^2.3.3",
"vue": "^3.2.45",
"vue-router": "^4.1.1",
"vue-virtual-scroller": "^2.0.0-beta.5",
Expand All @@ -43,12 +43,20 @@
"devDependencies": {
"@electron-forge/cli": "^6.0.1",
"@electron-forge/maker-deb": "^6.0.1",
"@vitejs/plugin-vue": "^2.3.3",
"@electron-forge/maker-squirrel": "^6.0.1",
"@electron-forge/maker-zip": "^6.0.1",
"@vitejs/plugin-vue": "^2.3.3",
"@electron-forge/plugin-auto-unpack-natives": "^6.2.1",
"electron": "^24.0.0",
"@vitejs/plugin-vue": "^2.3.3",
"vite": "^2.9.16"
},
"build": {
"win": {
"icon": "src/assets/icon.ico",
"productName": "BlurLyric"
}
},
"description": "高颜值,高性能,多平台支持的网易云音乐第三方音乐播放器",
"repository": {
"type": "git",
Expand Down
20 changes: 18 additions & 2 deletions preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@

// 所有Node.js API都可以在预加载过程中使用。
// 它拥有与Chrome扩展一样的沙盒。
const { ipcRenderer ,contextBridge} = require('electron')


window.addEventListener('DOMContentLoaded', () => {
electronBar = document.createElement('style')
electronBar.type = "text/css"
document.body.appendChild(electronBar)
electronBar.appendChild(document.createTextNode(".electron-control{display:block !important}"))
})
electronBar.appendChild(document.createTextNode(".electron-control{display:block !important};.windowControlBar{display:flex !important}"))
})

contextBridge.exposeInMainWorld('electronAPI',{
min:()=>{
// mainWindow.minimize()
ipcRenderer.send('min')
},
close:()=>{
ipcRenderer.send('close')

},
max:()=>{
ipcRenderer.send('max')
}})
1 change: 1 addition & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ async function checkVersion() {
async function consturctServer(moduleDefs) {

const app = express()
app.set('maxHeaderSize',30 * 1024 * 1024)
app.use('/blurlyric',router_blurlyric)
app.use(express.static(path.join(__dirname, 'dist')))

Expand Down
25 changes: 22 additions & 3 deletions serverRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,34 @@ router.get('/writeUser',(req,res)=>{
return
}
let dataSize = strSize(req.query.res.toString())
if(strSize(dataSize,'utf8')>8000000){
jsonTool('405',{msg: '文件过大 (>8mb)'},req,res)
if(strSize(dataSize,'utf8')>20000000){
jsonTool('405',{msg: '文件过大 (>20mb)'},req,res)
return
}
user.upsetConfig(req.query,(data)=>{
jsonTool('200',data,req,res)
})
})

router.post('/writeUserPlaylist',(req,res)=>{
// console.log(req.query)
// if (!req.query.id||!req.query.res) {
// jsonTool('405',null,req,res)
// return
// }
// let dataSize = strSize(req.query.res.toString())
// if(strSize(dataSize,'utf8')>20000000){
// jsonTool('405',{msg: '文件过大 (>20mb)'},req,res)
// return
// }
console.log(req);
jsonTool('200',req,'',res)

// user.upsetPlaylist(req.query,(data)=>{
// jsonTool('200',data,req,res)
// })
})

function jsonTool(code,data,req,res) {
res.json({
"code": code || 200,
Expand Down Expand Up @@ -90,7 +109,7 @@ async function getFileByUrl(url,fileName){
method: 'GET',
headers: { 'Content-Type': 'application/octet-stream' },
}).then(res=>res.buffer()).then(_=>{
fs.writeFile(path.join(__dirname,'./blurlyric/download/'+fileName +'.mp3'),_,'binary',function (err) {
fs.writeFile(path.join(__dirname,'./blurlyric/download/'+fileName ),_,'binary',function (err) {
downloadTrack.freeThread++
downloadTrack.try()

Expand Down

0 comments on commit ca92167

Please sign in to comment.