mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-10 01:23:48 +01:00
Add release ID to JSON download
This commit is contained in:
parent
060d60ba46
commit
6e1921f68b
@ -218,6 +218,7 @@ class Package(db.Model):
|
|||||||
"license": self.license.name,
|
"license": self.license.name,
|
||||||
"repo": self.repo,
|
"repo": self.repo,
|
||||||
"url": base_url + self.getDownloadURL(),
|
"url": base_url + self.getDownloadURL(),
|
||||||
|
"release": self.getDownloadRelease().id if self.getDownloadRelease() is not None else None,
|
||||||
"screenshots": [base_url + ss.url for ss in self.screenshots]
|
"screenshots": [base_url + ss.url for ss in self.screenshots]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,8 +237,6 @@ class Package(db.Model):
|
|||||||
type=self.type.toName(),
|
type=self.type.toName(),
|
||||||
author=self.author.username, name=self.name)
|
author=self.author.username, name=self.name)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getNewScreenshotURL(self):
|
def getNewScreenshotURL(self):
|
||||||
return url_for("create_screenshot_page",
|
return url_for("create_screenshot_page",
|
||||||
type=self.type.toName(),
|
type=self.type.toName(),
|
||||||
|
@ -33,7 +33,8 @@ def doPackageList(type):
|
|||||||
return jsonify(pkgs)
|
return jsonify(pkgs)
|
||||||
else:
|
else:
|
||||||
tags = Tag.query.all()
|
tags = Tag.query.all()
|
||||||
return render_template("packages/list.html", title=title, packages=query.all(), query=search, tags=tags, type=None if type is None else type.toName())
|
return render_template("packages/list.html", title=title, packages=query.all(), \
|
||||||
|
query=search, tags=tags, type=None if type is None else type.toName())
|
||||||
|
|
||||||
|
|
||||||
@app.route("/packages/")
|
@app.route("/packages/")
|
||||||
|
23
setup.py
23
setup.py
@ -52,6 +52,29 @@ if not os.path.isfile("db.sqlite"):
|
|||||||
licenses[row.name] = row
|
licenses[row.name] = row
|
||||||
db.session.add(row)
|
db.session.add(row)
|
||||||
|
|
||||||
|
mod = Package()
|
||||||
|
mod.approved = True
|
||||||
|
mod.name = "alpha"
|
||||||
|
mod.title = "Alpha Test"
|
||||||
|
mod.license = licenses["MIT"]
|
||||||
|
mod.type = PackageType.MOD
|
||||||
|
mod.author = ruben
|
||||||
|
mod.tags.append(tags["mapgen"])
|
||||||
|
mod.tags.append(tags["environment"])
|
||||||
|
mod.repo = "https://github.com/ezhh/other_worlds"
|
||||||
|
mod.issueTracker = "https://github.com/ezhh/other_worlds/issues"
|
||||||
|
mod.forums = 16015
|
||||||
|
mod.shortDesc = "The content library should not be used yet as it is still in alpha"
|
||||||
|
mod.desc = "This is the long desc"
|
||||||
|
db.session.add(mod)
|
||||||
|
|
||||||
|
rel = PackageRelease()
|
||||||
|
rel.package = mod
|
||||||
|
rel.title = "v1.0.0"
|
||||||
|
rel.url = "https://github.com/ezhh/handholds/archive/master.zip"
|
||||||
|
rel.approved = True
|
||||||
|
db.session.add(rel)
|
||||||
|
|
||||||
mod1 = Package()
|
mod1 = Package()
|
||||||
mod1.approved = True
|
mod1.approved = True
|
||||||
mod1.name = "awards"
|
mod1.name = "awards"
|
||||||
|
Loading…
Reference in New Issue
Block a user