Skip to content
Snippets Groups Projects
Commit 906d0205 authored by DarkGod's avatar DarkGod
Browse files

stuff for addon upload

parent df99b4ad
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,8 @@ function _M:simpleWaiter(title, text, width, count, max)
d:setupUI(true, true)
d.done = function(self) game:unregisterDialog(self) end
d.manual = function(self, ...) wait:manual(...) end
d.manualStep = function(self, ...) wait:manualStep(...) end
game:registerDialog(d)
......
......@@ -30,6 +30,15 @@ function _M:init(t)
Base.init(self, t)
end
function _M:manual()
core.wait.enableManualTick(true)
core.display.forceRedraw()
end
function _M:manualStep(nb)
core.wait.manualTick(nb or 1)
end
function _M:generate()
local left = core.display.loadImage("/data/gfx/waiter/left_basic.png")
local right = core.display.loadImage("/data/gfx/waiter/right_basic.png")
......
......@@ -23,7 +23,7 @@ local UserChat = require "profile-thread.UserChat"
module(..., package.seeall, class.make)
local debug = false
local debug = true
local mport = debug and 2259 or 2257
local pport = debug and 2260 or 2258
......@@ -588,6 +588,48 @@ function _M:orderAddonEnableUpload(o)
self:command("ADDN MODULEMAKER ON")
self:read("200")
end
function _M:orderAddonAuthoring(o)
if o.suborder == "create" then
local metadata = table.serialize(o.metadata)
self:command("ADDN CREATE_ADDON ", #metadata)
if self:read("200") then
self.sock:send(metadata)
if not self:read("200") then return cprofile.pushEvent(string.format("e='AddonAuthoring' suborder='create' ok=false reason=%q", self.last_error)) end
return cprofile.pushEvent("e='AddonAuthoring' suborder='create' ok=true")
else
return cprofile.pushEvent("e='AddonAuthoring' suborder='create' ok=false reason='metadata invalid'")
end
elseif o.suborder == "version" then
local f = fs.open(o.file, "r")
local data = {}
local size = 0
while true do
local l = f:read(1024)
if not l then break end
data[#data+1] = l
size = size + #l
end
f:close()
o.metadata.teaa_size = size
local metadata = table.serialize(o.metadata)
self:command("ADDN VERSION_ADDON ", #metadata)
if self:read("200") then
self.sock:send(metadata)
if not self:read("200") then return cprofile.pushEvent(string.format("e='AddonAuthoring' suborder='version' ok=false reason=%q", self.last_error)) end
cprofile.pushEvent("e='AddonAuthoring' suborder='version_upload_start' total="..size)
for i, d in ipairs(data) do
self.sock:send(d)
cprofile.pushEvent("e='AddonAuthoring' suborder='version_upload_progress' sent="..#d)
end
if not self:read("200") then return cprofile.pushEvent(string.format("e='AddonAuthoring' suborder='version' ok=false reason=%q", self.last_error)) end
return cprofile.pushEvent("e='AddonAuthoring' suborder='version' ok=true")
else
return cprofile.pushEvent("e='AddonAuthoring' suborder='version' ok=false reason='metadata invalid'")
end
end
end
--------------------------------------------------------------------
-- Pushes comming from the push socket
--------------------------------------------------------------------
......
......@@ -141,6 +141,7 @@ int thread_profile(void *data)
luaopen_socket_core(L);
luaopen_mime_core(L);
luaopen_zlib(L);
luaopen_physfs(L);
luaL_openlib(L, "cprofile", threadlib, 0); lua_pop(L, 1);
// Override "print" if requested
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment