From 235e8d11de7f1a65c59c7b83b04e08bd87f3ab91 Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Sat, 23 Mar 2019 12:20:48 -0400 Subject: [PATCH] cleanup --- sys/apps/Overview.lua | 4 +- sys/apps/system/cloud.lua | 86 +++++++++++++++++++------------------ sys/autorun/upgraded.lua | 2 +- sys/etc/{app.db => apps.db} | 0 4 files changed, 48 insertions(+), 44 deletions(-) rename sys/etc/{app.db => apps.db} (100%) diff --git a/sys/apps/Overview.lua b/sys/apps/Overview.lua index 952137d..58c65b8 100644 --- a/sys/apps/Overview.lua +++ b/sys/apps/Overview.lua @@ -11,6 +11,7 @@ local UI = require('ui') local Util = require('util') local colors = _G.colors +local device = _G.device local fs = _G.fs local os = _G.os local pocket = _G.pocket @@ -168,9 +169,10 @@ local function loadApplications() pocket = not not pocket, advancedPocket = pocket and term.isColor(), advancedComputer = not turtle and not pocket and term.isColor(), + neuralInterface = not not device.neuralInterface, } - applications = Util.readTable('sys/etc/app.db') + applications = Util.readTable('sys/etc/apps.db') for dir in pairs(Packages:installed()) do local path = fs.combine('packages/' .. dir, 'etc/apps.db') diff --git a/sys/apps/system/cloud.lua b/sys/apps/system/cloud.lua index 5feeb6d..fce0536 100644 --- a/sys/apps/system/cloud.lua +++ b/sys/apps/system/cloud.lua @@ -4,50 +4,52 @@ local UI = require('ui') local colors = _G.colors -local config = Config.load('cloud') +if _G.http.websocket then + local config = Config.load('cloud') -local tab = UI.Tab { - tabTitle = 'Cloud', - description = 'Cloud catcher options', - key = UI.TextEntry { - x = 3, ex = -3, y = 2, - limit = 32, - value = config.key, - shadowText = 'Cloud key', - accelerators = { - enter = 'update_key', - }, - }, - button = UI.Button { - x = 3, y = 4, - text = 'Update', - event = 'update_key', - }, - labelText = UI.TextArea { - x = 2, ex = -2, y = 6, - textColor = colors.yellow, - marginRight = 0, - value = string.format( -[[Use a non-changing cloud key. Note that only a single computer can use this session at one time. -To obtain a key, visit: -%shttps://cloud-catcher.squiddev.cc%s then bookmark: -%shttps://cloud-catcher.squiddev.cc/?id=%sKEY - ]], - Ansi.orange, Ansi.reset, Ansi.orange, Ansi.black), - }, -} + local tab = UI.Tab { + tabTitle = 'Cloud', + description = 'Cloud catcher options', + key = UI.TextEntry { + x = 3, ex = -3, y = 2, + limit = 32, + value = config.key, + shadowText = 'Cloud key', + accelerators = { + enter = 'update_key', + }, + }, + button = UI.Button { + x = 3, y = 4, + text = 'Update', + event = 'update_key', + }, + labelText = UI.TextArea { + x = 2, ex = -2, y = 6, + textColor = colors.yellow, + marginRight = 0, + value = string.format( + [[Use a non-changing cloud key. Note that only a single computer can use this session at one time. + To obtain a key, visit: + %shttps://cloud-catcher.squiddev.cc%s then bookmark: + %shttps://cloud-catcher.squiddev.cc/?id=%sKEY + ]], + Ansi.white, Ansi.reset, Ansi.white, Ansi.white), + }, + } -function tab:eventHandler(event) - if event.type == 'update_key' then - if #self.key.value > 0 then - config.key = self.key.value - else - config.key = nil + function tab:eventHandler(event) + if event.type == 'update_key' then + if #self.key.value > 0 then + config.key = self.key.value + else + config.key = nil + end + Config.update('cloud', config) + self:emit({ type = 'success_message', message = 'Updated' }) end - Config.update('cloud', config) - self:emit({ type = 'success_message', message = 'Updated' }) - end + end + + return tab end -return tab - diff --git a/sys/autorun/upgraded.lua b/sys/autorun/upgraded.lua index 2ce1d9d..c23d1e9 100644 --- a/sys/autorun/upgraded.lua +++ b/sys/autorun/upgraded.lua @@ -1,4 +1,4 @@ if fs.exists('sys/apps/shell') and fs.exists('sys/apps/shell.lua') then fs.delete('sys/apps/shell') end -if fs.exists('sys/autorun/gps.lua') then fs.delete('sys/autorun/gps.lua') end \ No newline at end of file +if fs.exists('sys/etc/app.db') then fs.delete('sys/etc/app.db') end \ No newline at end of file diff --git a/sys/etc/app.db b/sys/etc/apps.db similarity index 100% rename from sys/etc/app.db rename to sys/etc/apps.db