Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
T
Taiko Web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
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
nanahira
Taiko Web
Commits
d1ae38e9
Commit
d1ae38e9
authored
Oct 28, 2018
by
Bui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add assets_baseurl config option
parent
6d07afaa
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
106 additions
and
102 deletions
+106
-102
app.py
app.py
+21
-12
config.example.json
config.example.json
+2
-1
public/src/css/main.css
public/src/css/main.css
+0
-8
public/src/js/loader.js
public/src/js/loader.js
+82
-81
templates/index.html
templates/index.html
+1
-0
No files found.
app.py
View file @
d1ae38e9
...
@@ -27,6 +27,25 @@ def query_db(query, args=(), one=False):
...
@@ -27,6 +27,25 @@ def query_db(query, args=(), one=False):
return
(
rv
[
0
]
if
rv
else
None
)
if
one
else
rv
return
(
rv
[
0
]
if
rv
else
None
)
if
one
else
rv
def
get_config
():
if
os
.
path
.
isfile
(
'config.json'
):
try
:
config
=
json
.
load
(
open
(
'config.json'
,
'r'
))
except
ValueError
:
print
'WARNING: Invalid config.json, using default values'
config
=
{}
else
:
print
'WARNING: No config.json found, using default values'
config
=
{}
if
not
config
.
get
(
'songs_baseurl'
):
config
[
'songs_baseurl'
]
=
''
.
join
([
request
.
host_url
,
'songs'
])
+
'/'
if
not
config
.
get
(
'assets_baseurl'
):
config
[
'assets_baseurl'
]
=
''
.
join
([
request
.
host_url
,
'assets'
])
+
'/'
return
config
def
parse_osu
(
osu
):
def
parse_osu
(
osu
):
osu_lines
=
open
(
osu
,
'r'
)
.
read
()
.
replace
(
'
\x00
'
,
''
)
.
split
(
'
\n
'
)
osu_lines
=
open
(
osu
,
'r'
)
.
read
()
.
replace
(
'
\x00
'
,
''
)
.
split
(
'
\n
'
)
sections
=
{}
sections
=
{}
...
@@ -110,7 +129,7 @@ def route_index():
...
@@ -110,7 +129,7 @@ def route_index():
version
=
None
version
=
None
if
os
.
path
.
isfile
(
'version.json'
):
if
os
.
path
.
isfile
(
'version.json'
):
version
=
json
.
load
(
open
(
'version.json'
,
'r'
))
version
=
json
.
load
(
open
(
'version.json'
,
'r'
))
return
render_template
(
'index.html'
,
version
=
version
)
return
render_template
(
'index.html'
,
version
=
version
,
config
=
get_config
()
)
@
app
.
route
(
'/api/preview'
)
@
app
.
route
(
'/api/preview'
)
...
@@ -165,17 +184,7 @@ def route_api_songs():
...
@@ -165,17 +184,7 @@ def route_api_songs():
@
app
.
route
(
'/api/config'
)
@
app
.
route
(
'/api/config'
)
def
route_api_config
():
def
route_api_config
():
if
os
.
path
.
isfile
(
'config.json'
):
config
=
get_config
()
config
=
json
.
load
(
open
(
'config.json'
,
'r'
))
else
:
print
'WARNING: No config.json found, using default values'
config
=
{
'songs_baseurl'
:
''
.
join
([
request
.
host_url
,
'songs'
])
+
'/'
}
if
not
config
.
get
(
'songs_baseurl'
):
config
[
'songs_baseurl'
]
=
''
.
join
([
request
.
host_url
,
'songs'
])
+
'/'
return
jsonify
(
config
)
return
jsonify
(
config
)
...
...
config.example.json
View file @
d1ae38e9
{
{
"songs_baseurl"
:
""
"songs_baseurl"
:
""
,
"assets_baseurl"
:
""
}
}
public/src/css/main.css
View file @
d1ae38e9
@font-face
{
font-family
:
TnT
;
src
:
url("/assets/fonts/TnT.ttf")
format
(
"truetype"
);
}
@font-face
{
font-family
:
Kozuka
;
src
:
url("/assets/fonts/Kozuka.otf")
format
(
"truetype"
);
}
html
,
html
,
body
{
body
{
margin
:
0
;
margin
:
0
;
...
...
public/src/js/loader.js
View file @
d1ae38e9
...
@@ -30,7 +30,10 @@ class Loader{
...
@@ -30,7 +30,10 @@ class Loader{
)
)
snd
.
sfxLoudGain
.
setVolume
(
1.2
)
snd
.
sfxLoudGain
.
setVolume
(
1.2
)
snd
.
buffer
.
load
(
"
/assets/audio/
"
+
assets
.
audioOgg
).
then
(()
=>
{
this
.
promises
.
push
(
this
.
ajax
(
"
/api/config
"
).
then
(
conf
=>
{
gameConfig
=
JSON
.
parse
(
conf
)
snd
.
buffer
.
load
(
gameConfig
.
assets_baseurl
+
"
audio/
"
+
assets
.
audioOgg
).
then
(()
=>
{
this
.
oggNotSupported
=
false
this
.
oggNotSupported
=
false
},
()
=>
{
},
()
=>
{
this
.
oggNotSupported
=
true
this
.
oggNotSupported
=
true
...
@@ -53,7 +56,7 @@ class Loader{
...
@@ -53,7 +56,7 @@ class Loader{
var
image
=
document
.
createElement
(
"
img
"
)
var
image
=
document
.
createElement
(
"
img
"
)
this
.
promises
.
push
(
pageEvents
.
load
(
image
))
this
.
promises
.
push
(
pageEvents
.
load
(
image
))
image
.
id
=
name
image
.
id
=
name
image
.
src
=
"
/assets/
img/
"
+
name
image
.
src
=
gameConfig
.
assets_baseurl
+
"
img/
"
+
name
this
.
assetsDiv
.
appendChild
(
image
)
this
.
assetsDiv
.
appendChild
(
image
)
assets
.
image
[
id
]
=
image
assets
.
image
[
id
]
=
image
})
})
...
@@ -79,10 +82,6 @@ class Loader{
...
@@ -79,10 +82,6 @@ class Loader{
assets
.
songs
=
JSON
.
parse
(
songs
)
assets
.
songs
=
JSON
.
parse
(
songs
)
}))
}))
this
.
promises
.
push
(
this
.
ajax
(
"
/api/config
"
).
then
(
conf
=>
{
gameConfig
=
JSON
.
parse
(
conf
)
}))
assets
.
views
.
forEach
(
name
=>
{
assets
.
views
.
forEach
(
name
=>
{
var
id
=
this
.
getFilename
(
name
)
var
id
=
this
.
getFilename
(
name
)
this
.
promises
.
push
(
this
.
ajax
(
"
src/views/
"
+
name
).
then
(
page
=>
{
this
.
promises
.
push
(
this
.
ajax
(
"
src/views/
"
+
name
).
then
(
page
=>
{
...
@@ -113,13 +112,15 @@ class Loader{
...
@@ -113,13 +112,15 @@ class Loader{
},
this
.
errorMsg
.
bind
(
this
))
},
this
.
errorMsg
.
bind
(
this
))
})
})
}))
}
}
loadSound
(
name
,
gain
){
loadSound
(
name
,
gain
){
if
(
this
.
oggNotSupported
&&
name
.
endsWith
(
"
.ogg
"
)){
if
(
this
.
oggNotSupported
&&
name
.
endsWith
(
"
.ogg
"
)){
name
=
name
.
slice
(
0
,
-
4
)
+
"
.wav
"
name
=
name
.
slice
(
0
,
-
4
)
+
"
.wav
"
}
}
var
id
=
this
.
getFilename
(
name
)
var
id
=
this
.
getFilename
(
name
)
return
gain
.
load
(
"
/assets/
audio/
"
+
name
).
then
(
sound
=>
{
return
gain
.
load
(
gameConfig
.
assets_baseurl
+
"
audio/
"
+
name
).
then
(
sound
=>
{
assets
.
sounds
[
id
]
=
sound
assets
.
sounds
[
id
]
=
sound
})
})
}
}
...
...
templates/index.html
View file @
d1ae38e9
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
<link
rel=
"stylesheet"
href=
"/src/css/loadsong.css?{{version.commit_short}}"
>
<link
rel=
"stylesheet"
href=
"/src/css/loadsong.css?{{version.commit_short}}"
>
<link
rel=
"stylesheet"
href=
"/src/css/game.css?{{version.commit_short}}"
>
<link
rel=
"stylesheet"
href=
"/src/css/game.css?{{version.commit_short}}"
>
<link
rel=
"stylesheet"
href=
"/src/css/debug.css?{{version.commit_short}}"
>
<link
rel=
"stylesheet"
href=
"/src/css/debug.css?{{version.commit_short}}"
>
<link
rel=
"stylesheet"
href=
"{{config.assets_baseurl}}fonts/fonts.css?{{version.commit_short}}"
>
<script
src=
"/src/js/lib/fontdetect.min.js?{{version.commit_short}}"
></script>
<script
src=
"/src/js/lib/fontdetect.min.js?{{version.commit_short}}"
></script>
...
...
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