-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
59 lines (49 loc) · 1.34 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
local PACKAGE = "com.frqstbite.aselink"
local uuid = dofile('./uuid.lua')
--
--
--
function open()
local data = Dialog("Open Shared Sprite")
:entry { id="key", label="Aselink Key:", text=uuid(), focused=true, }
:separator { text="Advanced" }
:entry { id="host", label="Host:", text="api.frqst.site/aselink", }
:button { id="connect", text="Open", }
:button { id="cancel", text="Cancel", }
:show { }.data
if data.connect then
print("Connecting to server...")
--[[local user = data.user_value
local url = "http://localhost:8080/share/" .. user
local response = http.request(url)
local sprite = Sprite{ fromFile = response.body }
app.activeSprite = sprite]]
end
end
function share()
local sprite = app.activeSprite
end
--
--
--
function init(plugin)
-- Register open shared command
plugin:newCommand {
id = PACKAGE .. ":openSharedSprite",
title = "Open Shared Sprite...",
group = "file_open",
onclick = open,
}
-- Register share command
plugin:newCommand {
id = PACKAGE .. ":shareSprite",
title = "Share",
group = "sprite_duplicate",
onclick = share,
onenabled = function()
return app.activeSprite ~= nil
end,
}
end
function exit()
end