Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
srvpro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
srvpro
Commits
c8de458e
Commit
c8de458e
authored
Jun 12, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update pre util
parent
bb8f4fec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
41 deletions
+64
-41
config.json
config.json
+27
-0
config.pre.json
config.pre.json
+0
-11
ygopro-pre.js
ygopro-pre.js
+37
-30
No files found.
config.json
View file @
c8de458e
...
@@ -22,6 +22,33 @@
...
@@ -22,6 +22,33 @@
"password"
:
"123456"
,
"password"
:
"123456"
,
"port"
:
7933
"port"
:
7933
},
},
"pre_util"
:
{
"enabled"
:
false
,
"port"
:
7944
,
"password"
:
"123456"
,
"git_html_path"
:
"../mercury233.github.io/"
,
"html_path"
:
"../mercury233.github.io/ygosrv233/"
,
"html_filename"
:
"pre.html"
,
"git_db_path"
:
"../ygopro-unofficial/"
,
"db_path"
:
"../ygopro-unofficial/unofficial/"
,
"html_img_rel_path"
:
"pre/pics/"
,
"html_img_thumbnail"
:
"thumbnail/"
,
"ygopro_path"
:
"../ygopro-pre/"
,
"only_show_dbs"
:
{
"news.cdb"
:
true
,
"pre-release.cdb"
:
true
},
"html_gits"
:
[
{
"name"
:
"GitHub"
,
"push"
:
[
"push"
,
"origin"
]
},
{
"name"
:
"Coding"
,
"push"
:
[
"push"
,
"coding"
,
"master:master"
]
}
]
},
"http"
:
{
"http"
:
{
"port"
:
7922
,
"port"
:
7922
,
"password"
:
"123456"
,
"password"
:
"123456"
,
...
...
config.pre.json
deleted
100644 → 0
View file @
bb8f4fec
{
"port"
:
2333
,
"password"
:
"123456"
,
"git_html_path"
:
"../mercury233.github.io/"
,
"html_path"
:
"../mercury233.github.io/ygosrv233/"
,
"html_filename"
:
"pre.html"
,
"git_db_path"
:
"../ygopro-cards/"
,
"db_path"
:
"../ygopro-cards/unofficial/"
,
"html_img_rel_path"
:
"pre/pics/"
,
"ygopro_path"
:
"../ygopro-pre/"
}
\ No newline at end of file
ygopro-pre.js
View file @
c8de458e
...
@@ -17,7 +17,13 @@ var moment = require('moment');
...
@@ -17,7 +17,13 @@ var moment = require('moment');
moment
.
locale
(
'
zh-cn
'
);
moment
.
locale
(
'
zh-cn
'
);
var
constants
=
require
(
'
./constants.json
'
);
var
constants
=
require
(
'
./constants.json
'
);
var
config
=
require
(
'
./config.pre.json
'
);
var
nconf
=
require
(
'
nconf
'
);
nconf
.
file
(
'
./config.user.json
'
);
var
defaultconfig
=
require
(
'
./config.json
'
);
nconf
.
defaults
(
defaultconfig
);
var
settings
=
nconf
.
get
();
config
=
settings
.
modules
.
pre_util
;
//全卡HTML列表
//全卡HTML列表
var
cardHTMLs
=
[];
var
cardHTMLs
=
[];
...
@@ -52,7 +58,7 @@ var loadDb = function(db_file) {
...
@@ -52,7 +58,7 @@ var loadDb = function(db_file) {
var
cardHTML
=
"
<tr>
"
;
var
cardHTML
=
"
<tr>
"
;
cardHTML
+=
'
<td><a href="
'
+
config
.
html_img_rel_path
+
result
.
id
+
'
.jpg" target="_blank"><img src="
'
+
config
.
html_img_rel_path
+
'
thumbnail/
'
+
result
.
id
+
'
.jpg" alt="
'
+
result
.
name
+
'
"></a></td>
'
;
cardHTML
+=
'
<td><a href="
'
+
config
.
html_img_rel_path
+
result
.
id
+
'
.jpg" target="_blank"><img src="
'
+
config
.
html_img_rel_path
+
config
.
html_img_thumbnail
+
result
.
id
+
'
.jpg" alt="
'
+
result
.
name
+
'
"></a></td>
'
;
cardHTML
+=
'
<td>
'
+
result
.
name
+
'
</td>
'
;
cardHTML
+=
'
<td>
'
+
result
.
name
+
'
</td>
'
;
var
cardText
=
""
;
var
cardText
=
""
;
...
@@ -183,7 +189,7 @@ var loadAllDbs = function() {
...
@@ -183,7 +189,7 @@ var loadAllDbs = function() {
var
files
=
fs
.
readdirSync
(
config
.
db_path
+
"
expansions/
"
);
var
files
=
fs
.
readdirSync
(
config
.
db_path
+
"
expansions/
"
);
for
(
var
i
in
files
)
{
for
(
var
i
in
files
)
{
var
filename
=
files
[
i
];
var
filename
=
files
[
i
];
if
(
filename
.
slice
(
-
4
)
===
"
.cdb
"
)
{
if
(
filename
.
slice
(
-
4
)
===
"
.cdb
"
&&
(
!
config
.
only_show_dbs
||
config
.
only_show_dbs
.
length
==
0
||
config
.
only_show_dbs
[
filename
])
)
{
loadDb
(
config
.
db_path
+
"
expansions/
"
+
filename
);
loadDb
(
config
.
db_path
+
"
expansions/
"
+
filename
);
}
}
}
}
...
@@ -198,7 +204,7 @@ var fetchDatas = function() {
...
@@ -198,7 +204,7 @@ var fetchDatas = function() {
});
});
proc
.
stderr
.
setEncoding
(
'
utf8
'
);
proc
.
stderr
.
setEncoding
(
'
utf8
'
);
proc
.
stderr
.
on
(
'
data
'
,
function
(
data
)
{
proc
.
stderr
.
on
(
'
data
'
,
function
(
data
)
{
sendResponse
(
"
git pull
error
:
"
+
data
);
sendResponse
(
"
git pull:
"
+
data
);
});
});
proc
.
on
(
'
close
'
,
function
(
code
)
{
proc
.
on
(
'
close
'
,
function
(
code
)
{
sendResponse
(
"
数据更新完成。
"
);
sendResponse
(
"
数据更新完成。
"
);
...
@@ -210,7 +216,7 @@ var fetchDatas = function() {
...
@@ -210,7 +216,7 @@ var fetchDatas = function() {
});
});
proc2
.
stderr
.
setEncoding
(
'
utf8
'
);
proc2
.
stderr
.
setEncoding
(
'
utf8
'
);
proc2
.
stderr
.
on
(
'
data
'
,
function
(
data
)
{
proc2
.
stderr
.
on
(
'
data
'
,
function
(
data
)
{
sendResponse
(
"
git pull
error
:
"
+
data
);
sendResponse
(
"
git pull:
"
+
data
);
});
});
proc2
.
on
(
'
close
'
,
function
(
code
)
{
proc2
.
on
(
'
close
'
,
function
(
code
)
{
sendResponse
(
"
网页同步完成。
"
);
sendResponse
(
"
网页同步完成。
"
);
...
@@ -225,30 +231,27 @@ var pushDatas = function() {
...
@@ -225,30 +231,27 @@ var pushDatas = function() {
}
catch
(
error
)
{
}
catch
(
error
)
{
sendResponse
(
"
git error:
"
+
error
.
stdout
);
sendResponse
(
"
git error:
"
+
error
.
stdout
);
}
}
var
proc2
=
spawn
(
"
git
"
,
[
"
push
"
,
"
gitcafe
"
,
"
master:gitcafe-pages
"
],
{
cwd
:
config
.
git_html_path
,
env
:
process
.
env
});
for
(
var
i
in
config
.
html_gits
)
{
proc2
.
stdout
.
setEncoding
(
'
utf8
'
);
var
git
=
config
.
html_gits
[
i
];
proc2
.
stdout
.
on
(
'
data
'
,
function
(
data
)
{
var
proc
=
spawn
(
"
git
"
,
git
.
push
,
{
cwd
:
config
.
git_html_path
,
env
:
process
.
env
});
sendResponse
(
"
git push:
"
+
data
);
proc
.
stdout
.
setEncoding
(
'
utf8
'
);
});
proc
.
stdout
.
on
(
'
data
'
,
(
function
(
git
)
{
proc2
.
stderr
.
setEncoding
(
'
utf8
'
);
return
function
(
data
)
{
proc2
.
stderr
.
on
(
'
data
'
,
function
(
data
)
{
sendResponse
(
git
.
name
+
"
git push:
"
+
data
);
sendResponse
(
"
git push error:
"
+
data
);
}
});
})(
git
));
proc2
.
on
(
'
close
'
,
function
(
code
)
{
proc
.
stderr
.
setEncoding
(
'
utf8
'
);
sendResponse
(
"
gitcafe上传完成。
"
);
proc
.
stderr
.
on
(
'
data
'
,
(
function
(
git
)
{
});
return
function
(
data
)
{
var
proc
=
spawn
(
"
git
"
,
[
"
push
"
],
{
cwd
:
config
.
git_html_path
,
env
:
process
.
env
});
sendResponse
(
git
.
name
+
"
git push:
"
+
data
);
proc
.
stdout
.
setEncoding
(
'
utf8
'
);
}
proc
.
stdout
.
on
(
'
data
'
,
function
(
data
)
{
})(
git
));
sendResponse
(
"
git push:
"
+
data
);
proc
.
on
(
'
close
'
,
(
function
(
git
)
{
});
return
function
(
code
)
{
proc
.
stderr
.
setEncoding
(
'
utf8
'
);
sendResponse
(
git
.
name
+
"
上传完成。
"
);
proc
.
stderr
.
on
(
'
data
'
,
function
(
data
)
{
}
sendResponse
(
"
git push:
"
+
data
);
})(
git
));
});
}
proc
.
on
(
'
close
'
,
function
(
code
)
{
sendResponse
(
"
github上传完成。
"
);
});
}
}
//将数据库文件夹里卡图复制到列表页对应文件夹里,同步
//将数据库文件夹里卡图复制到列表页对应文件夹里,同步
...
@@ -260,9 +263,13 @@ var copyImages = function() {
...
@@ -260,9 +263,13 @@ var copyImages = function() {
//将数据库文件夹复制到YGOPRO文件夹里,同步
//将数据库文件夹复制到YGOPRO文件夹里,同步
var
copyToYGOPRO
=
function
()
{
var
copyToYGOPRO
=
function
()
{
execSync
(
'
rm -rf
"
'
+
config
.
ygopro_path
+
'
expansions/*
'
+
'
"
'
);
execSync
(
'
rm -rf
'
+
config
.
ygopro_path
+
'
expansions/*
'
+
'
'
);
execSync
(
'
cp -rf "
'
+
config
.
db_path
+
'
expansions
'
+
'
" "
'
+
config
.
ygopro_path
+
'
"
'
);
execSync
(
'
cp -rf "
'
+
config
.
db_path
+
'
expansions
'
+
'
" "
'
+
config
.
ygopro_path
+
'
"
'
);
execSync
(
'
cp -rf "
'
+
config
.
db_path
+
'
script
'
+
'
" "
'
+
config
.
ygopro_path
+
'
expansions"
'
);
execSync
(
'
cp -rf "
'
+
config
.
db_path
+
'
script
'
+
'
" "
'
+
config
.
ygopro_path
+
'
expansions"
'
);
try
{
execSync
(
'
cp -rf "
'
+
config
.
db_path
+
'
lflist.conf
'
+
'
" "
'
+
config
.
ygopro_path
+
'
"
'
);
}
catch
(
e
)
{}
sendResponse
(
"
更新完成。
"
);
sendResponse
(
"
更新完成。
"
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment