@@ -66,7 +66,7 @@ local cli = {
66
66
error = {" [" , colors .red , " E" , colors .white , " ] " }
67
67
}
68
68
69
- local config = ...
69
+ local config , up = ...
70
70
do -- Configuration parsing
71
71
if type (config ) ~= " table" then
72
72
printError (" Invalid input configuration, make sure you're using the provided init file." )
@@ -612,32 +612,30 @@ local player_scanner = function() -- Login/out scanner thread
612
612
end
613
613
end
614
614
615
- local common = {
616
- unhide_update = false ,
617
- run = {}
618
- }
619
- common .refresh = function ()
620
- local done = term .redirect (main )
621
- local x , y = term .getSize ()
622
- common .bY = y - 1
623
- if common .unhide_update then
624
- common .bX = x - 6
625
- term .setCursorPos (x - 6 , y - 1 )
626
- term .blit (" TRS \24 " , " 888f8" , " 14efb" )
627
- else
628
- common .bX = x - 5
629
- term .setCursorPos (x - 5 , y - 1 )
630
- term .blit (" TRS" , " 888" , " 14e" )
615
+ local update_interaction = function () -- Update UI scanning and handling thread
616
+ local common = {
617
+ run = {}
618
+ }
619
+ common .refresh = function ()
620
+ local done = term .redirect (main )
621
+ local x , y = term .getSize ()
622
+ common .bY = y - 1
623
+ if # common .run > 0 then
624
+ common .bX = x - 6
625
+ term .setCursorPos (x - 6 , y - 1 )
626
+ term .blit (" TRS \24 " , " 888f8" , " 14efb" )
627
+ else
628
+ common .bX = x - 5
629
+ term .setCursorPos (x - 5 , y - 1 )
630
+ term .blit (" TRS" , " 888" , " 14e" )
631
+ end
632
+ term .setBackgroundColor (colors .black ) -- Reset terminal and cursor
633
+ term .setTextColor (colors .white )
634
+ term .redirect (done )
631
635
end
632
- term .setBackgroundColor (colors .black ) -- Reset terminal and cursor
633
- term .setTextColor (colors .white )
634
- term .redirect (done )
635
- end
636
-
637
- local update_interaction = function ()
638
636
parallel .waitForAll (function () -- Update checker on initialize
639
- if config .updates .check .dependencies then
640
- local suc , deps = config . updates .check .dependencies ()
637
+ if config .updates .notify .dependencies then
638
+ local suc , deps = up .check .dependencies ()
641
639
local suffixer
642
640
if type (deps ) == " table" and # deps > 0 then
643
641
if # deps == 1 then
@@ -646,18 +644,16 @@ local update_interaction = function()
646
644
suffixer = {" Utilities: " , " are " }
647
645
end
648
646
allium .log (suffixer [1 ].. table.concat (deps , " , " ).. suffixer [2 ].. " ready to be updated" )
649
- common .run [# common .run + 1 ] = {config .updates .run .dependencies }
650
- common .unhide_update = true
647
+ common .run [# common .run + 1 ] = {up .run .dependencies }
651
648
elseif not suc then
652
649
print (cli .error , true , " Error in checking for dependency updates: " .. deps )
653
650
end
654
651
end
655
- if config .updates .check .allium then
656
- local sha = config . updates .check .allium ()
652
+ if config .updates .notify .allium then
653
+ local sha = up .check .allium ()
657
654
if sha ~= config .sha then
658
655
allium .log (" Allium is ready to be updated" )
659
- common .run [# common .run + 1 ] = {config .updates .run .allium , sha }
660
- common .unhide_update = true
656
+ common .run [# common .run + 1 ] = {up .run .allium , sha }
661
657
elseif not sha then
662
658
allium .warn (" Failed to scan for allium updates" )
663
659
end
@@ -685,7 +681,7 @@ local update_interaction = function()
685
681
allium .log (" Shutting down..." )
686
682
sleep (1 )
687
683
os .shutdown ()
688
- elseif x - common .bX == 4 and common .unhide_update then -- Update
684
+ elseif x - common .bX == 4 and # common .run > 0 then -- Update
689
685
allium .log (" Downloading updates..." )
690
686
for i = 1 , # common .run do
691
687
local s , err = pcall (table.unpack (common .run [i ]))
0 commit comments