summaryrefslogtreecommitdiff
path: root/cgi-bin
diff options
context:
space:
mode:
Diffstat (limited to 'cgi-bin')
-rwxr-xr-xcgi-bin/save16
-rw-r--r--cgi-bin/thumbnail_upload4
2 files changed, 12 insertions, 8 deletions
diff --git a/cgi-bin/save b/cgi-bin/save
index f6b0498..2bfb8c2 100755
--- a/cgi-bin/save
+++ b/cgi-bin/save
@@ -53,7 +53,7 @@ def strip_querystring(url):
p = re.compile('^[^\?]*')
return p.findall(url)[0]
-def store_shader_in_db(script, shader_id=False, image_url="",username=""):
+def store_shader_in_db(script, shader_id=False, image_url="",username="",name="",width="0",height="0"):
conn = MySQLdb.connect(host= "127.0.0.1",
user="asdfus",
@@ -66,8 +66,8 @@ def store_shader_in_db(script, shader_id=False, image_url="",username=""):
shader_id = conn.insert_id()
conn.commit()
- x.execute("""INSERT INTO shaders (script, image_url, username, time, shader_id) values (%s,%s,%s,%s,%s)""" ,
- (script, image_url, username, NOW, shader_id)
+ x.execute("""INSERT INTO shaders (script, image_url, username, name, remote_addr, time, shader_id, width, height) values (%s,%s,%s,%s,%s,%s,%s,%s,%s)""" ,
+ (script, image_url, username, name, REMOTE_IP, NOW, shader_id, width, height)
);
last_id = conn.insert_id()
conn.commit()
@@ -84,7 +84,7 @@ def main():
cgitb.enable()
limit_test = check_limits(API_NAME, MAX_INTERVAL, REQUEST_LIMIT, REMOTE_IP, NOW)
if limit_test: return error("You have exceeded the maximum number of requests, try again in %s seconds" % limit_test);
- #form should contain script, shader_id, username, image_url
+ #form should contain script, shader_id, username, name, image_url
form = cgi.FieldStorage(keep_blank_values=1)
if 'script' not in form or not form['script']:
error( 'script not found')
@@ -97,9 +97,13 @@ def main():
error("Cannot save this shader:%s" % test_failure)
shader_version_id = store_shader_in_db(
- form['script'].value, form['shader_id'].value,
+ form['script'].value,
+ form['shader_id'].value,
image_url,
- form['username'].value);
+ form['username'].value,
+ form['name'].value,
+ form['width'].value,
+ form['height'].value);
if not shader_version_id:
error('DB Error')
else:
diff --git a/cgi-bin/thumbnail_upload b/cgi-bin/thumbnail_upload
index 8ee9866..ab12c66 100644
--- a/cgi-bin/thumbnail_upload
+++ b/cgi-bin/thumbnail_upload
@@ -145,7 +145,7 @@ sub upload_to_AmazonS3{
sub error{
my $message = shift;
- my $resp = { success => "false", "error" => $message };
+ my $resp = { success => JSON::false, "error" => $message };
print JSON->new->encode($resp);
exit 1;
}
@@ -174,7 +174,7 @@ sub main{
error( "problem adding value to db");
}
my $resp = {
- success => "true",
+ success => JSON::true,
url => $thumbnail_url,
filesize => $filesize
};