Skip to content

Commit

Permalink
Merge pull request #51 from gnehs/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
gnehs authored Sep 2, 2018
2 parents f223047 + 0ee081c commit 78b28c3
Show file tree
Hide file tree
Showing 11 changed files with 170 additions and 97 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ FROM node:10-alpine
WORKDIR /app
# 安裝必要組件
RUN apk add --no-cache make gcc g++ python git
RUN npm install --production
# 拉取程式碼
RUN git clone https://github.com/gnehs/PokaPlayer.git .
# 覆蓋拉取的程式碼避免干擾到 dev
COPY . /app
# node_modules
RUN npm install --production
# 環境設定
ENV NODE_ENV=production
EXPOSE 3000
Expand Down
6 changes: 3 additions & 3 deletions dataModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ router.get('/addPin/', async(req, res) => {
let moduleName = req.query.moduleName
let _module = moduleName in moduleList ? require(moduleList[moduleName].js) : null;
// 沒這東西
if (!_module || moduleList[moduleName].active.indexOf('addPin') == -1) return res.status(501).send("The required module is currently unavailable :(")
if (!_module || moduleList[moduleName].active.indexOf('addPin') == -1) return res.send('disabled')

res.json(await _module.addPin(req.query.type, req.query.id, req.query.name))
});
Expand All @@ -112,7 +112,7 @@ router.get('/unPin/', async(req, res) => {
let moduleName = req.query.moduleName
let _module = moduleName in moduleList ? require(moduleList[moduleName].js) : null;
// 沒這東西
if (!_module || moduleList[moduleName].active.indexOf('unPin') == -1) return res.status(501).send("The required module is currently unavailable :(")
if (!_module || moduleList[moduleName].active.indexOf('unPin') == -1) return res.send('disabled')

res.json(await _module.unPin(req.query.type, req.query.id, req.query.name))
});
Expand All @@ -122,7 +122,7 @@ router.get('/isPinned/', async(req, res) => {
let moduleName = req.query.moduleName
let _module = moduleName in moduleList ? require(moduleList[moduleName].js) : null;
// 沒這東西
if (!_module || moduleList[moduleName].active.indexOf('isPinned') == -1) return res.status(501).send("The required module is currently unavailable :(")
if (!_module || moduleList[moduleName].active.indexOf('isPinned') == -1) return res.send('disabled')

res.json(await _module.isPinned(req.query.type, req.query.id, req.query.name))
});
Expand Down
2 changes: 1 addition & 1 deletion dataModule/dsm.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ async function addPin(type, id, name) {
} else
PARAMS_JSON = [{
key: "items",
value: `[{"type":"${type}","criteria":{${type}:${id}},"name":"${name}"}]`
value: `[{"type":"${type}","criteria":{"${type}":"${id}"},"name":"${name}"}]`
}]
result = (await getAPI("entry.cgi", "SYNO.AudioStation.Pin", "pin", PARAMS_JSON))
if (result.success)
Expand Down
2 changes: 1 addition & 1 deletion dataModule/netease2.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ async function getCovers(ids) {
}

async function search(keywords, limit = 30, type = 'song') {
async function parseSearchResults(results, type = 'song') {
async function parseSearchResults(results=[], type = 'song') {
switch (type) {
case 'song':
return await getSongs(results.map(x => x.id));
Expand Down
12 changes: 1 addition & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ app.get('/debug', async(req, res) => {
res.status(403).send('Permission Denied Desu')
else
res.send(config.PokaPlayer.debug ? (await git.raw(['rev-parse', '--short', 'HEAD'])).slice(0, -1) : 'false')

})

app.get('/meting', (req, res) => {
Expand All @@ -184,9 +183,6 @@ app.get('/ping', (req, res) => {
res.send("PONG")
})




// 登入
app.get('/login/', (req, res) => {
res.render('login')
Expand All @@ -203,14 +199,8 @@ app.get('/logout/', (req, res) => {
req.session.destroy()
res.redirect("/")
});
var updateCookie = schedule.scheduleJob("'* */12 * * *'", async function() {
//請求登入 Cookie
//console.log("正在自動更新令牌")
var a = await syno.login(config.DSM)
});

app.use((req, res, next) => {
res.status(404).redirect("/")
});
// 報錯處理
process.on('uncaughtException', (err) => console.log(err));
process.on('uncaughtException', err => { if (config.PokaPlayer.debug) console.log(err) });
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pokaplayer",
"version": "0.10.1",
"version": "0.10.2",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
39 changes: 22 additions & 17 deletions public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ header.mdui-appbar.mdui-appbar-fixed {
padding-right: 0;
}

@media screen and (max-width: 767px) {
.mdui-fab {
margin-bottom: 64px;
}
}


/* 列表 */

Expand Down Expand Up @@ -255,18 +261,17 @@ header.mdui-appbar.mdui-appbar-fixed {

/* 專輯歌曲頁面 - 專輯簡介 */

.album-info {
margin-top: 16px;
.info-header {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}

.album-info * {
.info-header * {
transition: all .3s ease;
}

.album-info>.cover {
.info-header>.cover {
height: 200px;
width: 200px;
align-content: center;
Expand All @@ -275,7 +280,7 @@ header.mdui-appbar.mdui-appbar-fixed {
background-position: center;
}

.album-info>.info {
.info-header>.info {
flex: 1;
flex-direction: column;
display: flex;
Expand All @@ -285,59 +290,59 @@ header.mdui-appbar.mdui-appbar-fixed {
overflow: hidden;
}

.album-info>.info>.album-name {
.info-header>.info>.album-name {
font-size: 40px;
line-height: 48px;
font-weight: bold;
}

.album-info>.info>.artist-name {
.info-header>.info>.artist-name {
font-size: 32px;
line-height: 40px;
}

.album-info>.info>.grow {
.info-header>.info>.grow {
flex: 1;
}

.album-info>.info>.footer {
.info-header>.info>.footer {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}

.album-info>.info>.footer>.time {
.info-header>.info>.footer>.time {
flex: 1;
}

.album-info>.info .time {
.info-header>.info .time {
font-size: 20px;
line-height: 42px;
}

.album-info>.info .actions .mdui-btn {
.info-header>.info .actions .mdui-btn {
height: 42px;
width: 42px;
}

@media screen and (max-width: 768px) {
.album-info>.info {
.info-header>.info {
padding-left: 12px;
padding-right: 0;
}
.album-info>.cover {
.info-header>.cover {
height: 150px;
width: 150px;
}
.album-info>.info>.album-name {
.info-header>.info>.album-name {
font-size: 24px;
line-height: 30px;
}
.album-info>.info>.artist-name {
.info-header>.info>.artist-name {
font-size: 20px;
line-height: 25px;
}
.album-info>.info .time {
.info-header>.info .time {
font-size: 16px;
}
}
Expand Down
7 changes: 2 additions & 5 deletions public/js/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ function getBackground() {
/*===== Pin =====*/
async function isPinned(source, type, id, name) {
let result = (await axios.get(`/pokaapi/isPinned/?moduleName=${source}&type=${type}&id=${id}&name=${name}`))
if (result.status == 501)
return 'disabled'
else
return result.data
return result.data
}
async function addPin(source, type, id, name) {
let result = (await axios.get(`/pokaapi/addPin/?moduleName=${source}&type=${type}&id=${id}&name=${name}`)).data
Expand Down Expand Up @@ -49,7 +46,7 @@ async function getLrc(artist, title, id = false, source) {
let result;
if (id) {
result = await axios.get(`/pokaapi/lyric/?moduleName=${encodeURIComponent(source)}&id=${encodeURIComponent(id)}`)
if (result.data.lyrics[0].lyric.match(lyricRegex))
if (result.data.lyrics[0].lyric && result.data.lyrics[0].lyric.match(lyricRegex))
return result.data.lyrics[0].lyric
}
result = await axios.get(`/pokaapi/searchLyrics/?keyword=${encodeURIComponent(title+' '+artist)}`)
Expand Down
Loading

0 comments on commit 78b28c3

Please sign in to comment.