Skip to content

Commit

Permalink
fix some bugs on shortcuts and new tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaaoBlues committed Jun 24, 2022
1 parent f021e2a commit 42a8f5e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion copypasta.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,8 @@ def upload():
file.save(full_path)
store_to_history({"file_name" : f"{file.filename}","file_type" : f"{file_type}","date" : f"{time}","path" : f"{full_path}"})

open_browser_if_settings_okay(f"http://127.0.0.1:21987/image_preview?path={path}")

open_browser_if_settings_okay(f"{COPYPASTA_URL}/image_preview?image_id={get_history_file_last_id()}")

return jsonify({"upload_status" : "true"})

Expand Down
4 changes: 2 additions & 2 deletions launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ def move_launcher():
f.close()

# 2
create_shortcut(path="C:\\Users\\Public\\Desktop\\CopyPasta.lnk",target="C:\\Program Files\\CopyPasta\\copypasta\\launcher.exe",wDir="C:\\Program Files\\CopyPasta\\",icon="C:\\Program Files\\CopyPasta\\copypasta\\static\\favicon.ico")
create_shortcut(path="C:\\Users\\Public\\Desktop\\CopyPasta.lnk",target="C:\\Program Files\\CopyPasta\\launcher.exe",wDir="C:\\Program Files\\CopyPasta\\",icon="C:\\Program Files\\CopyPasta\\copypasta\\static\\favicon.ico")

#3
create_shortcut(path=f"C:\\Users\\{getuser()}\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\CopyPasta.lnk",target="C:\\Program Files\\CopyPasta\\copypasta\\launcher.exe",wDir="C:\\Program Files\\CopyPasta\\",icon="C:\\Program Files\\CopyPasta\\copypasta\\static\\favicon.ico")
create_shortcut(path=f"C:\\Users\\{getuser()}\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\CopyPasta.lnk",target="C:\\Program Files\\CopyPasta\\launcher.exe",wDir="C:\\Program Files\\CopyPasta\\",icon="C:\\Program Files\\CopyPasta\\copypasta\\static\\favicon.ico")


if __name__ == "__main__":
Expand Down
6 changes: 4 additions & 2 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,14 @@ def get_history():

return history


def get_history_file_last_id():
return len(ElementTree.parse("static/history.xml").getroot()) -1


def get_history_file_by_id(file_id):

history = []


if file_id < len(ElementTree.parse("static/history.xml").getroot()):

return loads(ElementTree.parse("static/history.xml").getroot()[file_id].text)
Expand Down

0 comments on commit 42a8f5e

Please sign in to comment.