Skip to content

Commit

Permalink
now display copypasta version in main page
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaaoBlues committed Jun 22, 2022
1 parent c2f8506 commit 9cea1a5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion copypasta.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def home():


#render the html with the history
return render_template("index.html",hist = get_history(),ip=get_private_ip(),hostname=socket.gethostname(),tab=path.exists("static/tab"))
return render_template("index.html",server_version=get_server_version(),hist = get_history(),ip=get_private_ip(),hostname=socket.gethostname(),tab=path.exists("static/tab"))

else:
return abort(403)
Expand Down Expand Up @@ -654,6 +654,10 @@ def upload():
check_templates_update()

#open tab in web browser


# NEEDS TO REPLACE WITH COPYPAST CUSTOM URL WHEN TESTS ARE DONE ON ADDING TO HOSTS FILE PROCESS
#
Process(target=open_link_process, args=("http://127.0.0.1:21987",)).start()

if not is_server_already_running():
Expand Down
1 change: 1 addition & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ <h6>

</h6>
<hr>
Server version : {{server_version}}
<a href="javascript:shutdown_server();"><h6>Server shutdown <a class="bi bi-power" href="javascript:shutdown_server();"></a></h6></a>
</div>
</div>
Expand Down
11 changes: 10 additions & 1 deletion util.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,5 +276,14 @@ def add_copypasta_to_hosts_file():
f.write("\n127.0.0.1:21987\tcopypasta")

f.close()



def get_server_version():


if not path.exists("version"):
return "version file not found :/"

with open("version","r") as f:
return f.read()

2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.1
1.6.3

0 comments on commit 9cea1a5

Please sign in to comment.