shop password config
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
local UI = require('opus.ui')
|
local UI = require('opus.ui')
|
||||||
|
local Krist = require('swshop.krist')--??
|
||||||
|
|
||||||
local colors = _G.colors
|
local colors = _G.colors
|
||||||
local device = _G.device
|
local device = _G.device
|
||||||
@@ -20,30 +21,18 @@ local wizardPage = UI.WizardPage {
|
|||||||
required = true,
|
required = true,
|
||||||
},
|
},
|
||||||
[2] = UI.TextEntry {
|
[2] = UI.TextEntry {
|
||||||
formLabel = 'Password', formKey = 'password',
|
|
||||||
shadowText = 'password or private key',
|
|
||||||
limit = 256,
|
|
||||||
required = true,
|
|
||||||
help = 'Krist wallet password',
|
|
||||||
},
|
|
||||||
[3] = UI.TextEntry {
|
|
||||||
formLabel = 'Header', formKey = 'header',
|
formLabel = 'Header', formKey = 'header',
|
||||||
help = 'Text to show in header',
|
help = 'Text to show in header',
|
||||||
limit = 64,
|
limit = 64,
|
||||||
shadowText = "xxxx's shop",
|
shadowText = "xxxx's shop",
|
||||||
required = false,
|
required = false,
|
||||||
},
|
},
|
||||||
[4] = UI.Checkbox {
|
[3] = UI.Checkbox {
|
||||||
formLabel = 'Is private key', formKey = 'isPrivateKey',
|
|
||||||
help = 'Password is in private key format',
|
|
||||||
limit = 64,
|
|
||||||
},
|
|
||||||
[5] = UI.Checkbox {
|
|
||||||
formLabel = 'Single shop', formKey = 'refundInvalid',
|
formLabel = 'Single shop', formKey = 'refundInvalid',
|
||||||
help = 'Only this shop using this domain',
|
help = 'Only this shop uses this domain',
|
||||||
limit = 64,
|
limit = 64,
|
||||||
},
|
},
|
||||||
[6] = UI.Chooser {
|
[4] = UI.Chooser {
|
||||||
width = 9,
|
width = 9,
|
||||||
formLabel = 'Font Size', formKey = 'textScale',
|
formLabel = 'Font Size', formKey = 'textScale',
|
||||||
nochoice = 'Small',
|
nochoice = 'Small',
|
||||||
@@ -53,10 +42,49 @@ local wizardPage = UI.WizardPage {
|
|||||||
},
|
},
|
||||||
help = 'Adjust text scaling',
|
help = 'Adjust text scaling',
|
||||||
},
|
},
|
||||||
|
[5] = UI.TextEntry {
|
||||||
|
formLabel = 'Password', formKey = 'password',
|
||||||
|
shadowText = 'password or private key',
|
||||||
|
limit = 256,
|
||||||
|
required = true,
|
||||||
|
pass = true,
|
||||||
|
help = 'Krist wallet password',
|
||||||
|
},
|
||||||
|
[6] = UI.Checkbox {
|
||||||
|
formLabel = 'Is private key', formKey = 'isPrivateKey',
|
||||||
|
help = 'Password is in private key format',
|
||||||
|
limit = 64,
|
||||||
|
ispkey = true,
|
||||||
|
},
|
||||||
|
[7] = UI.TextEntry {
|
||||||
|
inactive = true,
|
||||||
|
backgroundColor = colors.cyan,
|
||||||
|
textColor = colors.yellow,
|
||||||
|
formLabel = 'Using address',
|
||||||
|
formKey = 'address',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local function makeAddress(text, isPrivateKey)
|
||||||
|
local privKey = text
|
||||||
|
if not isPrivateKey then
|
||||||
|
privKey = Krist.toKristWalletFormat(privKey)
|
||||||
|
end
|
||||||
|
return Krist.makev2address(privKey)
|
||||||
|
end
|
||||||
|
|
||||||
|
function wizardPage.form:eventHandler(event)
|
||||||
|
if (event.type == 'text_change' and event.element.pass) or
|
||||||
|
(event.type == 'checkbox_change' and event.element.ispkey) then
|
||||||
|
self[7].value = makeAddress(self[5].value, self[6].value)
|
||||||
|
self[7]:draw()
|
||||||
|
end
|
||||||
|
return UI.Form.eventHandler(self, event)
|
||||||
|
end
|
||||||
|
|
||||||
function wizardPage:setNode(node)
|
function wizardPage:setNode(node)
|
||||||
|
node.address = node.password and makeAddress(node.password, node.isPrivateKey) or ''
|
||||||
self.form:setValues(node)
|
self.form:setValues(node)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ local Util = require('opus.util')
|
|||||||
|
|
||||||
local fs = _G.fs
|
local fs = _G.fs
|
||||||
local os = _G.os
|
local os = _G.os
|
||||||
local shell = _ENV.shell
|
|
||||||
|
|
||||||
local w = require("swshop.w")
|
local w = require("swshop.w")
|
||||||
local r = require("swshop.r")
|
local r = require("swshop.r")
|
||||||
|
|||||||
Reference in New Issue
Block a user