Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kodex
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
kodex
Commits
06b6dc28
Commit
06b6dc28
authored
Sep 05, 2017
by
Yannick Chudy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
relative path to static
parent
2a89dbd1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
12 deletions
+18
-12
botapadapp.py
botapadapp.py
+10
-9
homepage.html
templates/homepage.html
+8
-3
No files found.
botapadapp.py
View file @
06b6dc28
...
@@ -28,8 +28,9 @@ PATH = "./static/images" # images storage
...
@@ -28,8 +28,9 @@ PATH = "./static/images" # images storage
KEY
=
codecs
.
open
(
"secret/key.txt"
,
'r'
,
encoding
=
'utf8'
)
.
read
()
.
strip
()
KEY
=
codecs
.
open
(
"secret/key.txt"
,
'r'
,
encoding
=
'utf8'
)
.
read
()
.
strip
()
# padagraph host t o connect
# padagraph host t o connect
HOST
=
"http://padagraph.io"
STATIC_HOST
=
os
.
environ
.
get
(
'STATIC_HOST'
,
"http://padagraph.io"
)
HOST
=
os
.
environ
.
get
(
'PDG_HOST'
,
"http://localhost:5000"
)
ENGINES_HOST
=
os
.
environ
.
get
(
'ENGINES_HOST'
,
"http://padagraph.io"
)
KEY
=
codecs
.
open
(
"../me.local"
,
'r'
,
encoding
=
'utf8'
)
.
read
()
.
strip
()
KEY
=
codecs
.
open
(
"../me.local"
,
'r'
,
encoding
=
'utf8'
)
.
read
()
.
strip
()
# delete before import
# delete before import
...
@@ -39,7 +40,7 @@ DELETE = os.environ.get('BOTAPAD_DELETE', "True").lower() == "true"
...
@@ -39,7 +40,7 @@ DELETE = os.environ.get('BOTAPAD_DELETE', "True").lower() == "true"
# app
# app
print
(
"== Botapad
%
s
%
s =="
%
(
"DEBUG"
if
DEBUG
else
""
,
"DELETE"
if
DELETE
else
""
)
)
print
(
"== Botapad
%
s
%
s =="
%
(
"DEBUG"
if
DEBUG
else
""
,
"DELETE"
if
DELETE
else
""
)
)
print
(
"==
%
s =="
%
HOST
)
print
(
"==
engines:
%
s static:
%
s =="
%
(
ENGINES_HOST
,
STATIC_HOST
)
)
app
=
Flask
(
__name__
)
app
=
Flask
(
__name__
)
app
.
config
[
'DEBUG'
]
=
DEBUG
app
.
config
[
'DEBUG'
]
=
DEBUG
...
@@ -104,13 +105,13 @@ def snapshot(gid, **kwargs):
...
@@ -104,13 +105,13 @@ def snapshot(gid, **kwargs):
"""
"""
path
=
'
%
s/
%
s.png'
%
(
PATH
,
gid
)
path
=
'
%
s/
%
s.png'
%
(
PATH
,
gid
)
#driver, HOST, gid, path, width, height, {iframe params}
#driver, HOST, gid, path, width, height, {iframe params}
getScreenShot
(
driver
,
HOST
,
gid
,
path
,
400
,
400
,
**
kwargs
)
getScreenShot
(
driver
,
ENGINES_
HOST
,
gid
,
path
,
400
,
400
,
**
kwargs
)
def
img_url
(
gid
):
def
img_url
(
gid
):
return
'
%
s/
%
s.png'
%
(
PATH
,
gid
)
return
'
%
s/
%
s.png'
%
(
PATH
,
gid
)
def
graph_url
(
gid
):
def
graph_url
(
gid
):
return
'
%
s/graph/
%
s'
%
(
HOST
,
gid
)
return
'
%
s/graph/
%
s'
%
(
ENGINES_
HOST
,
gid
)
# === app routes ===
# === app routes ===
...
@@ -213,7 +214,7 @@ def home():
...
@@ -213,7 +214,7 @@ def home():
def
pad2pdg
(
gid
,
url
):
def
pad2pdg
(
gid
,
url
):
description
=
"imported from
%
s"
%
url
description
=
"imported from
%
s"
%
url
bot
=
Botagraph
(
HOST
,
KEY
)
bot
=
Botagraph
(
ENGINES_
HOST
,
KEY
)
botapad
=
Botapad
(
bot
,
gid
,
description
,
delete
=
DELETE
)
botapad
=
Botapad
(
bot
,
gid
,
description
,
delete
=
DELETE
)
return
bot
.
parse
(
url
,
separator
=
'auto'
,
debug
=
app
.
config
[
'DEBUG'
])
return
bot
.
parse
(
url
,
separator
=
'auto'
,
debug
=
app
.
config
[
'DEBUG'
])
...
@@ -247,7 +248,7 @@ def botimport(repo, content_type="html"):
...
@@ -247,7 +248,7 @@ def botimport(repo, content_type="html"):
#raise ValueError(request)
#raise ValueError(request)
action
=
"
%
s?
%
s"
%
(
repo
,
request
.
query_string
)
action
=
"
%
s?
%
s"
%
(
repo
,
request
.
query_string
)
print
"action "
,
action
print
"action "
,
action
routes
=
"
%
s/engines"
%
HOST
routes
=
"
%
s/engines"
%
ENGINES_
HOST
graph
=
None
graph
=
None
data
=
None
data
=
None
...
@@ -293,7 +294,7 @@ def botimport(repo, content_type="html"):
...
@@ -293,7 +294,7 @@ def botimport(repo, content_type="html"):
try
:
try
:
if
repo
==
"padagraph"
:
if
repo
==
"padagraph"
:
pad2pdg
(
gid
,
url
)
pad2pdg
(
gid
,
url
)
data
=
"
%
s/xplor/
%
s.json"
%
(
HOST
,
gid
)
data
=
"
%
s/xplor/
%
s.json"
%
(
ENGINES_
HOST
,
gid
)
complete
=
True
complete
=
True
if
content_type
==
"json"
:
if
content_type
==
"json"
:
...
@@ -348,7 +349,7 @@ def botimport(repo, content_type="html"):
...
@@ -348,7 +349,7 @@ def botimport(repo, content_type="html"):
#snapshot(gid, **params)D
#snapshot(gid, **params)D
return
render_template
(
'homepage.html'
,
return
render_template
(
'homepage.html'
,
static_host
=
HOST
,
action
=
action
,
content_type
=
content_type
,
color
=
color
,
static_host
=
STATIC_
HOST
,
action
=
action
,
content_type
=
content_type
,
color
=
color
,
repo
=
repo
,
complete
=
complete
,
error
=
error
,
repo
=
repo
,
complete
=
complete
,
error
=
error
,
routes
=
routes
,
data
=
data
,
options
=
json
.
dumps
(
options
),
routes
=
routes
,
data
=
data
,
options
=
json
.
dumps
(
options
),
padurl
=
url
,
graphurl
=
graph_url
(
gid
)
,
img
=
img_url
(
gid
),
padurl
=
url
,
graphurl
=
graph_url
(
gid
)
,
img
=
img_url
(
gid
),
...
...
templates/homepage.html
View file @
06b6dc28
...
@@ -337,12 +337,17 @@
...
@@ -337,12 +337,17 @@
<a
class=
"active item"
href=
"{{padurl}}"
>
Imported from {{padurl}}
</a>
<a
class=
"active item"
href=
"{{padurl}}"
>
Imported from {{padurl}}
</a>
</div>
</div>
<script
src=
"{{static_host}}/static/bower_components/webcomponentsjs/webcomponents-lite.min.js"
></script>
<!-- require JS-->
<script
src=
"{{static_host}}/static/webcomponents-lite.js"
></script>
<script
data-main=
"{{static_host}}/static/main"
src=
"{{static_host}}/static/bower_components/requirejs/require.js"
></script>
<script
data-main=
"{{static_host}}/static/main"
src=
"{{static_host}}/static/require.js"
></script>
<link
rel=
"import"
href=
"{{static_host}}/static/padagraph-gviz-min.html"
/>
<!--
<link rel="import" href="{{static_host}}/static/padagraph_webcomponents/padagraph-collection.html"/>
<link rel="import" href="{{static_host}}/static/padagraph_webcomponents/padagraph-collection.html"/>
<link rel="import" href="{{static_host}}/static/padagraph_webcomponents/padagraph-controls.html"/>
<link rel="import" href="{{static_host}}/static/padagraph_webcomponents/padagraph-controls.html"/>
<link rel="import" href="{{static_host}}/static/padagraph_webcomponents/padagraph-gviz.html"/>
<link rel="import" href="{{static_host}}/static/padagraph_webcomponents/padagraph-gviz.html"/>
-->
<div
id=
"gviz"
>
<div
id=
"gviz"
>
<padagraph-gviz-json
routes=
"{{routes}}"
data=
"{{data}}"
>
<padagraph-gviz-json
routes=
"{{routes}}"
data=
"{{data}}"
>
...
...
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