Read from description.txt
This commit is contained in:
parent
7aec5368d8
commit
5424f0aa34
|
@ -68,7 +68,8 @@ $(function() {
|
||||||
|
|
||||||
performTask("/tasks/getmeta/new/?url=" + encodeURI(repoURL)).then(function(result) {
|
performTask("/tasks/getmeta/new/?url=" + encodeURI(repoURL)).then(function(result) {
|
||||||
console.log(result)
|
console.log(result)
|
||||||
$("#name").val(result.name)
|
$("#name").val(result.name || "")
|
||||||
|
$("#title").val(result.title || "")
|
||||||
const desc = result.description || ""
|
const desc = result.description || ""
|
||||||
if (desc.length > 0) {
|
if (desc.length > 0) {
|
||||||
const idx = desc.indexOf(".")
|
const idx = desc.indexOf(".")
|
||||||
|
|
|
@ -25,6 +25,12 @@ class GithubURLMaker:
|
||||||
def getModConfURL(self):
|
def getModConfURL(self):
|
||||||
return self.baseUrl + "/mod.conf"
|
return self.baseUrl + "/mod.conf"
|
||||||
|
|
||||||
|
def getDescURL(self):
|
||||||
|
return self.baseUrl + "/description.txt"
|
||||||
|
|
||||||
|
def getScreenshotURL(self):
|
||||||
|
return self.baseUrl + "/screenshot.png"
|
||||||
|
|
||||||
def parseConf(string):
|
def parseConf(string):
|
||||||
retval = {}
|
retval = {}
|
||||||
for line in string.split("\n"):
|
for line in string.split("\n"):
|
||||||
|
@ -55,7 +61,7 @@ def getMeta(urlstr):
|
||||||
try:
|
try:
|
||||||
contents = urllib.request.urlopen(urlmaker.getModConfURL()).read().decode("utf-8")
|
contents = urllib.request.urlopen(urlmaker.getModConfURL()).read().decode("utf-8")
|
||||||
conf = parseConf(contents)
|
conf = parseConf(contents)
|
||||||
for key in ["name", "description"]:
|
for key in ["name", "description", "title"]:
|
||||||
try:
|
try:
|
||||||
result[key] = conf[key]
|
result[key] = conf[key]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -65,4 +71,11 @@ def getMeta(urlstr):
|
||||||
except OSError:
|
except OSError:
|
||||||
print("mod.conf does not exist")
|
print("mod.conf does not exist")
|
||||||
|
|
||||||
|
if not "description" in result:
|
||||||
|
try:
|
||||||
|
contents = urllib.request.urlopen(urlmaker.getDescURL()).read().decode("utf-8")
|
||||||
|
result["description"] = contents.strip()
|
||||||
|
except OSError:
|
||||||
|
print("description.txt does not exist!")
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in New Issue