Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local arg = {...}
- local repl = {
- ["local gui = 0"] = {
- "local aliases = {}", -- Variable to store aliases
- "local page = 0",
- },
- [" openwallet()"] = {
- ' aliases = textutils.unserialize(readconfig("aliases"))', -- Loads alliases from config kst/aliases
- " while page ~= 0 do",
- },
- [' checkfile("autoupdate","true")'] = {
- ' checkfile("aliases","-- Aliases are case sensitive\\n"..textutils.serialize({anavrins = "kanavi35hk", Mayu = "kzezw94nx3"}))', -- Default content of kst/aliases
- ' checkfile("whitelisted","false")',
- },
- [" local recipient = read()"] = {
- " recipient = aliases[recipient] or recipient", -- Alias functionality for transfer
- " term.setCursorPos(33,6)",
- },
- [" subject = read()"] = {
- " subject = aliases[subject] or subject", -- Alias functionality for address lookup
- " if string.len(subject) == 10 then",
- },
- [" maxspace = read():lower()"] = {
- " maxspace = aliases[maxspace] or maxspace", -- Alias functionality for domain transfer
- " term.setCursorPos(19,7)",
- },
- }
- shell.run("clr")
- print("KristPatch, by Anavrins")
- print("Adds address aliases")
- print("Tested to work with Kristwallet v16")
- print("\nPress a key to continue")
- os.pullEvent("key")
- shell.run("clr")
- print("Downloading wallet")
- local web = http.get("https://raw.githubusercontent.com/BTCTaras/kristwallet/master/kristwallet")
- local lines = {}
- for line in web.readLine do
- lines[#lines+1] = line
- end
- web.close()
- local s = 0
- for i, line in pairs(lines) do
- if repl[line] and repl[line][2] == lines[i+1] then
- print("Patching line:", i)
- table.insert(lines, i+1, repl[line][1])
- s = s + 1
- end
- end
- print("Patched "..s.." out of 6 lines")
- local file = fs.open("kristwallet_aliases", "w")
- for i, line in pairs(lines) do
- file.writeLine(line)
- end
- file.close()
Advertisement
Add Comment
Please, Sign In to add comment