Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
adc2018-system
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
adc2018
adc2018-system
Commits
52c6bed8
Commit
52c6bed8
authored
Aug 17, 2018
by
Kento HASEGAWA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for local mode (clients other than localhost cannot control the system)
parent
43872a40
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
main.py
comm/server/main.py
+6
-2
part_client_table.html
comm/server/templates/part_client_table.html
+3
-2
part_question_status.html
comm/server/templates/part_question_status.html
+4
-0
No files found.
comm/server/main.py
View file @
52c6bed8
...
@@ -135,7 +135,10 @@ def update_answer_list(qname):
...
@@ -135,7 +135,10 @@ def update_answer_list(qname):
def
before_request
():
def
before_request
():
global
app_args
global
app_args
g
.
local_mode
=
(
request
.
remote_addr
==
"127.0.0.1"
)
if
app_args
[
"force_local_mode"
]:
g
.
local_mode
=
True
else
:
g
.
local_mode
=
(
request
.
remote_addr
in
[
"127.0.0.1"
,
"::1"
])
@
app
.
route
(
"/post"
,
methods
=
[
"POST"
])
@
app
.
route
(
"/post"
,
methods
=
[
"POST"
])
def
post
():
def
post
():
...
@@ -588,7 +591,7 @@ def question_status():
...
@@ -588,7 +591,7 @@ def question_status():
update_answer_list
(
qname
)
update_answer_list
(
qname
)
qdata
=
questions
[
qname
]
qdata
=
questions
[
qname
]
return
render_template
(
"part_question_status.html"
,
qname
=
qname
,
qdata
=
qdata
,
solvers
=
clients
[
"solver"
])
return
render_template
(
"part_question_status.html"
,
qname
=
qname
,
qdata
=
qdata
,
solvers
=
clients
[
"solver"
]
,
localmode
=
g
.
local_mode
)
@
app
.
route
(
'/ws'
)
@
app
.
route
(
'/ws'
)
def
ws
():
def
ws
():
...
@@ -660,6 +663,7 @@ if __name__ == "__main__":
...
@@ -660,6 +663,7 @@ if __name__ == "__main__":
parser
.
add_argument
(
"-a"
,
"--adccli"
,
action
=
"store"
,
type
=
str
,
default
=
"./adccli.json"
,
help
=
"Path to the ADCCLI configuration json file."
)
parser
.
add_argument
(
"-a"
,
"--adccli"
,
action
=
"store"
,
type
=
str
,
default
=
"./adccli.json"
,
help
=
"Path to the ADCCLI configuration json file."
)
parser
.
add_argument
(
"-q"
,
"--question"
,
action
=
"store"
,
type
=
str
,
default
=
"./problems"
,
help
=
"Path to the question folder."
)
parser
.
add_argument
(
"-q"
,
"--question"
,
action
=
"store"
,
type
=
str
,
default
=
"./problems"
,
help
=
"Path to the question folder."
)
parser
.
add_argument
(
"-o"
,
"--out"
,
action
=
"store"
,
type
=
str
,
default
=
"./answers"
,
help
=
"Path to the output folder."
)
parser
.
add_argument
(
"-o"
,
"--out"
,
action
=
"store"
,
type
=
str
,
default
=
"./answers"
,
help
=
"Path to the output folder."
)
parser
.
add_argument
(
"--force-local-mode"
,
action
=
"store_true"
,
default
=
False
,
help
=
"Apply local mode view to all clients."
)
parser
.
add_argument
(
"--debug"
,
action
=
"store_true"
,
default
=
False
,
help
=
"Debug mode."
)
parser
.
add_argument
(
"--debug"
,
action
=
"store_true"
,
default
=
False
,
help
=
"Debug mode."
)
args
=
vars
(
parser
.
parse_args
())
args
=
vars
(
parser
.
parse_args
())
app_args
=
args
app_args
=
args
...
...
comm/server/templates/part_client_table.html
View file @
52c6bed8
...
@@ -9,12 +9,13 @@ Viewer Mode
...
@@ -9,12 +9,13 @@ Viewer Mode
{% endif %}
{% endif %}
</p>
</p>
{% if local_mode %}
<h4>
自動運営システム
</h4>
<h4>
自動運営システム
</h4>
<button
type=
"button"
class=
"btn btn-primary"
id=
"adccli-login-button"
>
Login
</button>
<button
type=
"button"
class=
"btn btn-primary"
id=
"adccli-login-button"
>
Login
</button>
<button
type=
"button"
class=
"btn btn-light"
id=
"adccli-logout-button"
>
Logout
</button>
<button
type=
"button"
class=
"btn btn-light"
id=
"adccli-logout-button"
>
Logout
</button>
<span
id=
"adccli-status"
></span>
<br
/>
<button
type=
"button"
class=
"btn btn-info"
id=
"adccli-get-all-q"
>
問題DL
</button>
<button
type=
"button"
class=
"btn btn-info"
id=
"adccli-get-all-q"
>
問題DL
</button>
<span
id=
"adccli-status"
></span>
{% endif %}
<h4>
クライアント
</h4>
<h4>
クライアント
</h4>
<table
class=
"table table-bordered"
id=
"clients-table"
>
<table
class=
"table table-bordered"
id=
"clients-table"
>
...
...
comm/server/templates/part_question_status.html
View file @
52c6bed8
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-4"
>
<div
class=
"col-4"
>
<h3>
【{{qname}}】
</h3>
<h3>
【{{qname}}】
</h3>
{% if localmode %}
<p>
<p>
<button
class=
"btn btn-primary btn-lg start-button"
type=
"button"
data-qname=
"{{qname}}"
>
Start
</button>
<button
class=
"btn btn-primary btn-lg start-button"
type=
"button"
data-qname=
"{{qname}}"
>
Start
</button>
<button
class=
"btn btn-danger btn-lg stop-button"
type=
"button"
data-qname=
"all"
>
Stop
</button>
<button
class=
"btn btn-danger btn-lg stop-button"
type=
"button"
data-qname=
"all"
>
Stop
</button>
...
@@ -9,6 +10,9 @@
...
@@ -9,6 +10,9 @@
<button
class=
"btn btn-info btn-lg save-button"
type=
"button"
data-qname=
"{{qname}}"
>
Save
</button>
<button
class=
"btn btn-info btn-lg save-button"
type=
"button"
data-qname=
"{{qname}}"
>
Save
</button>
<button
class=
"btn btn-success btn-lg submit-button"
type=
"button"
data-qname=
"{{qname}}"
>
Up
</button>
<button
class=
"btn btn-success btn-lg submit-button"
type=
"button"
data-qname=
"{{qname}}"
>
Up
</button>
</p>
</p>
{% else %}
[View Only]
{% endif %}
</div>
</div>
<div
class=
"col-8"
>
<div
class=
"col-8"
>
<p>
処理結果
</p>
<p>
処理結果
</p>
...
...
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