Compare commits

...

5 Commits

Author SHA1 Message Date
rubenwardy fa35025ec1
Fix 404 on new package 2018-05-24 01:19:26 +01:00
rubenwardy 8d2bb12ad4
Add duplicate package check 2018-05-24 01:09:08 +01:00
rubenwardy 7bbb480ae2
Fix wizard showing after validation error 2018-05-24 01:04:25 +01:00
rubenwardy f809cdcab0
Fix sass generation 2018-05-23 21:19:02 +01:00
rubenwardy d5342d7096
Move static and uploads to public dir 2018-05-23 21:15:21 +01:00
18 changed files with 16 additions and 11 deletions

1
.gitignore vendored
View File

@ -5,6 +5,7 @@ main.css
tmp
log.txt
*.rdb
uploads
# Created by https://www.gitignore.io/api/linux,macos,python,windows

View File

Before

Width:  |  Height:  |  Size: 771 KiB

After

Width:  |  Height:  |  Size: 771 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -247,7 +247,7 @@ def importRepoScreenshot(id):
try:
filename = randomString(10) + ".png"
imagePath = os.path.join(app.config["UPLOAD_FOLDER"], filename)
imagePath = os.path.join("app/public/uploads", filename)
print(imagePath)
urllib.request.urlretrieve(urlmaker.getScreenshotURL(), imagePath)

View File

@ -47,7 +47,7 @@
<div class="pkg_meta">{{ render_submit_field(form.submit) }}</div>
</form>
{% if not package.title %}
{% if enable_wizard %}
<script src="/static/jquery.min.js"></script>
<script src="/static/url.min.js"></script>
<script src="/static/polltask.js"></script>

View File

@ -47,7 +47,7 @@ def doFileUpload(file, allowedExtensions, fileTypeName):
return None
filename = randomString(10) + "." + ext
file.save(os.path.join(app.config["UPLOAD_FOLDER"], filename))
file.save(os.path.join("app/public/uploads", filename))
return "/uploads/" + filename

View File

@ -34,12 +34,11 @@ def domain(url):
# Use nginx to serve files on production instead
@app.route("/static/<path:path>")
def send_static(path):
return send_from_directory("static", path)
return send_from_directory("public/static", path)
@app.route("/uploads/<path:path>")
def send_upload(path):
import os
return send_from_directory(os.path.abspath(app.config["UPLOAD_FOLDER"]), path)
return send_from_directory("public/uploads", path)
@app.route("/")
@menu.register_menu(app, ".", "Home")

View File

@ -168,6 +168,11 @@ def create_edit_package_page(author=None, name=None):
if request.method == "POST" and form.validate():
wasNew = False
if not package:
package = Package.query.filter_by(name=form["name"].data, author_id=author.id).first()
if package is not None:
flash("Package already exists!", "error")
return redirect(url_for("create_edit_package_page"))
package = Package()
package.author = author
wasNew = True
@ -191,7 +196,9 @@ def create_edit_package_page(author=None, name=None):
return redirect(package.getDetailsURL())
return render_template("packages/create_edit.html", package=package, form=form, author=author)
enableWizard = name is None and request.method != "POST"
return render_template("packages/create_edit.html", package=package, \
form=form, author=author, enable_wizard=enableWizard)
@app.route("/packages/<author>/<name>/approve/", methods=["POST"])
@login_required

View File

@ -45,7 +45,7 @@ def _getDirPath(originalPath, create=False):
return path
def sass(app, inputDir='scss', outputPath='static', force=False, cacheDir=None):
def sass(app, inputDir='scss', outputPath='static', force=False, cacheDir="public/static"):
static_url_path = app.static_url_path
inputDir = _getDirPath(inputDir)
cacheDir = _getDirPath(cacheDir or outputPath, True)

View File

@ -13,11 +13,9 @@ GITHUB_CLIENT_SECRET = ""
CELERY_BROKER_URL='redis://localhost:6379'
CELERY_RESULT_BACKEND='redis://localhost:6379'
UPLOAD_FOLDER="tmp"
USER_ENABLE_REGISTER = False
USER_ENABLE_CHANGE_USERNAME = False
s
MAIL_USERNAME=""
MAIL_PASSWORD=""
MAIL_DEFAULT_SENDER=""