Apply changes made on the server
This commit is contained in:
parent
69ab0cc31a
commit
e866dd28ce
@ -30,7 +30,7 @@ thefile = None #selected file for description
|
||||
positioninarray = 8 #counter
|
||||
listofdicts=[] #to be able to import and use json content
|
||||
datafromjson = []
|
||||
max_wordpath_items = 200 # limit the nr. of items, as to
|
||||
max_wordpath_items = 500 # limit the nr. of items, as to prevent possible glitches with bots
|
||||
|
||||
# #test getting json file from id
|
||||
# id = "17"
|
||||
@ -144,6 +144,7 @@ def description():
|
||||
#open json file, list filepaths in array and loop with thefile
|
||||
textfile=""
|
||||
textfiles=[]
|
||||
namefile=[]
|
||||
with open("static/"+jsonfilefordescription, 'r') as f:
|
||||
data_dict = json.load(f)
|
||||
datafromjson = data_dict["files"]
|
||||
@ -157,11 +158,12 @@ def description():
|
||||
session["id"] = list(ids) # ... and therefore, we have to convert it back
|
||||
for file in datafromjson:
|
||||
if file.lower().endswith(('.html')):
|
||||
namefile.append(file)
|
||||
with open("static/"+file,"r", encoding='utf-8') as f:
|
||||
textfile = f.read()
|
||||
textfile = Markup(textfile)
|
||||
textfiles.append(textfile)
|
||||
return render_template('description.html', datafromjson=datafromjson, itemid=itemid, textfiles=textfiles, idno=idno, index_dict=index_dict)
|
||||
return render_template('description.html', datafromjson=datafromjson, itemid=itemid, textfiles=textfiles, idno=idno, index_dict=index_dict, namefile=namefile)
|
||||
|
||||
@app.route('/diverge', methods=['GET'])
|
||||
def diverge():
|
||||
@ -206,11 +208,16 @@ def get_file():
|
||||
timelist = session["clicktime"]
|
||||
veryfirstnow = session['veryfirstnow']
|
||||
clickongetfiletime = datetime.now()
|
||||
|
||||
|
||||
tadam = None
|
||||
initialtime = None
|
||||
|
||||
# USER IP ADDRESS OBTENTION
|
||||
if request.environ.get('HTTP_X_FORWARDED_FOR') is None:
|
||||
userip = request.environ['REMOTE_ADDR']
|
||||
else:
|
||||
userip = request.environ['HTTP_X_FORWARDED_FOR'] # if behind a proxy
|
||||
|
||||
# CALCULATION OF INITIAL TIME BEFORE FIRST CLICK
|
||||
if len(timelist) and not (timelist[0] is None):
|
||||
thetime = timelist[0]
|
||||
thetime = str(thetime)
|
||||
@ -223,7 +230,12 @@ def get_file():
|
||||
initialtime = "."*initialtime
|
||||
|
||||
print(initialtime)
|
||||
#CALCULATE FILE NUMBER
|
||||
|
||||
dirListing = os.listdir("scores/")
|
||||
scorenumber = len(dirListing)
|
||||
|
||||
# CONVERSION OF TIME INTO FORMATS THAT CAN BE USED FOR CALCULATIONS
|
||||
timelistforoperations = []
|
||||
for t in timelist :
|
||||
t = str(t)
|
||||
@ -239,7 +251,7 @@ def get_file():
|
||||
print(timelistforoperations)
|
||||
print(idlist)
|
||||
|
||||
|
||||
# WEAVING DELAYS AND WORDS TOGETHER AS A HUGE STRING OF CHARACTERS
|
||||
for (word, time) in zip(wordpath,timelistforoperations):
|
||||
# for (word, time, uniqueid) in zip(wordpath,timelistforoperations, idlist):
|
||||
# print("word : "+word+"\n")
|
||||
@ -303,7 +315,7 @@ def get_file():
|
||||
# Using list comprehension
|
||||
out = [(fullscore[i:i+n]) for i in range(0, len(fullscore), n)]
|
||||
#joining the strings with linebreaks
|
||||
tadam = '\n'.join(out)
|
||||
tadam = '\n'.join(out) +"\n\nScore number : "+str(scorenumber)+ "\nGenerated at : "+str(clickongetfiletime)+"\nBy author : "+ userip
|
||||
|
||||
# have a message in file if no nav has been recorded so it's less dull than error page
|
||||
if tadam is None:
|
||||
|
2
static/.gitignore
vendored
Normal file
2
static/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
files
|
||||
|
@ -66,6 +66,14 @@ h2,h3{
|
||||
a{
|
||||
color: black;
|
||||
}
|
||||
|
||||
div.home > a{
|
||||
border-bottom: 1px dashed black;
|
||||
padding: 0.1em;
|
||||
margin: 0.5em;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
.text a:visited{
|
||||
color: red;
|
||||
}
|
||||
@ -111,12 +119,12 @@ div.homecontent{
|
||||
|
||||
div.home{
|
||||
/* padding: 1em 5em 1em 7.5em; */
|
||||
padding-left: 9em;
|
||||
padding-left: 15em;
|
||||
padding-top: 2em;
|
||||
padding-bottom: 3em;
|
||||
padding-right: 0.5em;
|
||||
padding-right: 5em;
|
||||
text-align: justify;
|
||||
font-size: 1em;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
div.home a{
|
||||
|
@ -27,6 +27,7 @@
|
||||
{% set count=[0] %}
|
||||
{% for item in datafromjson %}
|
||||
{% if item.lower().endswith(('.html')) %}
|
||||
<h3> {{ namefile[count[0]][12:-5] }}</h3>
|
||||
{{ textfiles[count[0]] }}
|
||||
{% if count.append(count.pop() + 1) %}{% endif %}
|
||||
<br/><br/><br/>
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
{% for word in wordlist_dict %}
|
||||
{% set address = "/diverge?search=" + word %}
|
||||
<a href={{address}}>{{ word }}</a> •
|
||||
<a href={{address}}>{{ word }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user