Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes files being zipped having wrong mimetype #65

Merged
merged 5 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ docker run --name solderpy --restart always -d -p 80:5000 thorfusion/solderpy
This is the public facing URL for your repository. If your repository location is already a URL, you can use the same value here. Include a trailing slash!

```bash
-e OLDER_MIRROR_URL=https://solder.example.com/mods/
-e SOLDER_MIRROR_URL=https://solder.example.com/mods/
```

This is the location of your mod reposistory. This can be a URL (remote repo), or an absolute file location (local repo, much faster). When a remote repo is used, Solder will have to download the entire file to calculate the MD5 hash.
Expand Down Expand Up @@ -168,6 +168,10 @@ Note that R2 Bucket functionality gets activated when R2_BUCKET is used
-e R2_BUCKET=
```

```bash
-e R2_REGION=
```

#### Adding a new user

Enables the /setup page if the database already exists and you need to add a new user
Expand Down
2 changes: 1 addition & 1 deletion api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

@api.route("/api/")
def api_info():
return jsonify({"api": "solder.py", "version": "v1.2.0", "stream": "DEV"})
return jsonify({"api": "solder.py", "version": "v1.2.1", "stream": "DEV"})


@api.route("/api/verify")
Expand Down
12 changes: 4 additions & 8 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.2.0"
__version__ = "1.2.1"

import os
from dotenv import load_dotenv
Expand Down Expand Up @@ -209,10 +209,6 @@ def newmodversion(id):
print(request.form["rehash_md5"])
print(request.form["rehash_url"])
if "newmodvermanual_submit" in request.form:
print(request.form["newmodvermanual_md5"])
print(request.form["newmodvermanual_version"])
print(request.form["newmodvermanual_mcversion"])
print(request.form["newmodvermanual_url"])
filesie2 = Modversion.get_file_size(mirror_url + request.form["newmodvermanual_url"])
print(filesie2)
if request.form["newmodvermanual_md5"] != "":
Expand Down Expand Up @@ -421,7 +417,6 @@ def modpackbuild(id):
if "token" not in session or not Session.verify_session(session["token"], request.remote_addr):
# New or invalid session, send to login
return redirect(url_for("login"))


try:
listmod = Mod.get_all_pretty_names()
Expand Down Expand Up @@ -508,8 +503,8 @@ def modlibrary_post():
if filew and allowed_file(filew.filename):
filename = secure_filename(filew.filename)
print("saving")
createFolder(app.config["UPLOAD_FOLDER"] + request.form["mod"] + "/")
filew.save(os.path.join(app.config["UPLOAD_FOLDER"] + request.form["mod"] + "/", filename))
createFolder(app.config["UPLOAD_FOLDER"] + secure_filename(request.form["mod"]) + "/")
filew.save(os.path.join(app.config["UPLOAD_FOLDER"] + secure_filename(request.form["mod"]) + "/", filename))
if R2_BUCKET != None:
keyname = "mods/" + request.form["mod"] + "/" + filename
R2.upload_file(app.config["UPLOAD_FOLDER"] + request.form["mod"] + "/" + filename, R2_BUCKET, keyname)
Expand Down Expand Up @@ -537,6 +532,7 @@ def modpacklibrary_post():
if "token" not in session or not Session.verify_session(session["token"], request.remote_addr):
# New or invalid session, send to login
return redirect(url_for("login"))

if request.method == "POST":
if "form-submit" in request.form:
hidden="0"
Expand Down
2 changes: 1 addition & 1 deletion static/js/solderpy.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function submit_zipfile_mods() {
saveAs(file2, modslugname + "-" + mcversionname + "-" + modversionname + ".zip");
}
// replaces the submitted file with the new zip file generated by previous code from the original file
let finalfile = new File([file2], modslugname + "-" + mcversionname + "-" + modversionname + ".zip",{type:"application/x-zip-compressed", lastModified:new Date().getTime()});
let finalfile = new File([file2], modslugname + "-" + mcversionname + "-" + modversionname + ".zip",{type:"application/zip", lastModified:new Date().getTime()});

let container = new DataTransfer();
container.items.add(finalfile);
Expand Down
2 changes: 1 addition & 1 deletion templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</ul>
</nav>
<div class="flex-column flex-shrink-0 p-3 text-white navcontainer2">
<p class="">Version 1.2.0</p>
<p class="">Version 1.2.1</p>
</div>

</div>
Expand Down