Advertisement
FFGFlash

api/system.lua

Sep 28th, 2021 (edited)
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.74 KB | None | 0 0
  1. local api = { LoadOrder = 0 }
  2. function api.Build()
  3.   local System = { Data = data("/nekOS") }
  4.   function System:getManifest() return self:load("main.manifest") end
  5.   function System:save(p,d) return self.Data:save(p,d) end
  6.   function System:load(p) return self.Data:load(p) end
  7.   function System.getTextColor() return colors[settings.get("nekos.text_color")] or colors.white end
  8.   function System.getBackgroundColor() return colors[settings.get("nekos.background_color")] or colors.gray end
  9.   function System:install() local m = self:getManifest() for k,v in pairs(m.Files) do v.Version = 0 end m:save() os.reboot() end
  10.   function System:getUpdate() local m=self:getManifest() pastebin:get(m.Code,"/nekOS/update.manifest",true) return self:load("update.manifest") end
  11.   function System:update() local o = rawget(self:getManifest(),"Data") for k,v in self:gupdate(m) do local s,e=pastebin:get(v.Code,k,true) end for k in self:glegacy(o) do fs.delete(k) end end
  12.   function System:getFileUpdates() local o,m=self:getManifest(),self:getUpdate() return table.filter(m.Files,function(v,k) return not o.Files[k] or v.Version ~= o.Files[k].Version end) end
  13.   function System:getLegacyFiles() local o,m=self:getManifest(),self:getUpdate() return table.filter(o.Files,function(v,k) return not m.Files[k] end) end
  14.   function System:gupdate() local e,i=self:getFileUpdates(),0 local k=table.keys(e) return function() i=i+1 if k[i] then return k[i],e[k[i]] end end end
  15.   function System:glegacy() local k,i=table.keys(self:getLegacyFiles()),0 return function() i=i+1 if k[i] then return k[i] end end end
  16.   function System:getMissingIcon() return settings.get("nekos.missing_icon") end
  17.   function System:getUser() return data:load("data.user") end
  18.   return System
  19. end
  20. return api
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement