Update apps via upload

This commit is contained in:
QuickMuffin8782 2024-02-03 15:26:02 -06:00 committed by GitHub
parent f643b9009d
commit ba0afe7009
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 101 additions and 9 deletions

View File

@ -67,13 +67,105 @@ local languages = {
[71] = "Russian", [71] = "Russian",
} }
--------------------------------------------------------------------------------
--[[
local GUI = require("GUI")
local screen = require("Screen")
local filesystem = require("Filesystem")
local color = require("Color")
local image = require("Image")
local internet = require("Internet")
local json = require("JSON")
local color = require("Color")
local paths = require("Paths")
local system = require("System")
local text = require("Text")
local number = require("Number")
local event = require("Event")
]]
local function createPopup(dispTitle, dispTxt, funcTouch, darkMode, enableAppIcon)
local txtTbl = text.wrap(dispTxt, 55)
local sysWorkspace, popupWindow, popupMenu = system.addWindow(GUI.titledWindow(50, 22, 60, 20, text.limit(tostring(dispTitle), 45) or "", true), (enableAppIcon and false or true))
popupWindow.backgroundPanel.colors.background = darkMode and 0x1E1E1E or GUI.WINDOW_TITLE_BACKGROUND_COLOR
popupWindow.titlePanel.colors.background = darkMode and 0x3C3C3C or GUI.WINDOW_TITLE_BACKGROUND_COLOR
popupWindow.titleLabel.colors.text = darkMode and 0xE1E1E1 or GUI.WINDOW_TITLE_TEXT_COLOR
popupWindow.actionButtons.maximize.colors.disabled.background = popupWindow.titlePanel.colors.background
popupWindow.actionButtons.maximize.disabled = true
popupWindow.actionButtons.minimize.colors.disabled.background = popupWindow.titlePanel.colors.background
popupWindow.actionButtons.minimize.disabled = true
local popupLayout = popupWindow:addChild(GUI.layout(1, 2, popupWindow.width, popupWindow.height - 1, 1, 1))
popupLayout:setSpacing(1, 1, 0)
for k, v in pairs(txtTbl) do
popupLayout:addChild(GUI.label(1, 1, 36, 1, darkMode and 0xFFFFFF or 0x0, v)):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_CENTER)
end
popupLayout:addChild(GUI.label(1, 1, 36, 2, 0x0, "")):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_CENTER)
popupLayout:addChild(GUI.button(1, 1, 36, 3, darkmode and 0x4B4B4B or 0xB4B4B4, 0x0, 0x969696, 0x0, "Ok")).onTouch = function()
popupWindow.actionButtons.close.onTouch()
if type(funcTouch) == "function" then
funcTouch()
end
end
sysWorkspace:draw()
end
local function checkConnection(url, funcLoad)
local data = ""
local success, reason = internet.rawRequest(
url or "http://httpbin.org/post/",
nil,
{
["User-Agent"] = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36",
["Content-Type"] = "application/x-www-form-urlencoded"
},
function(chunk)
data = data .. chunk
if type(funcLoad) == "function" then
funcLoad(chunk, data)
end
end,
math.huge,
"POST"
)
local r1, r2 = "", ""
if success then
r1, r2 = true, tostring(data)
else
r1, r2 = false, "Web request failed: " .. tostring(reason)
end
if r1 then
return true, "Connection is established"
else
if r2:lower():find("405") then
return true, "Connection is established"
elseif r2:lower():find("connection reset") or r2:lower():find("connection_reset") or r2:lower():find("connection-reset") then
return false, "DNS URL may be blocked by server host device's network, or connection problems are occurring on the device's network.\n\nCheck your connection to the host device's network. If problems continue occurring, try restarting the host's devices router connection."
else
return false, "Network error:\n"..tostring(reason).."\n\nCheck your connection to the host device's network. If problems continue occurring, try restarting the host's devices router connection."
end
end
end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
if not component.isAvailable("internet") then if not component.isAvailable("internet") then
GUI.alert("AppMarket requires internet card to work") createPopup("Connection error", "You'll need an internet card for this. Go find one in storage chests/containers or craft some for to open the app market.", nil, true)
return return
end end
local connected, connErr = checkConnection("http://mineos.buttex.ru/")
if not connected then
if connErr:find("403") then else
createPopup("Connection error", "Failed to connect to MineOS App Market services.\n\n"..connErr, nil, true)
return
end
end
filesystem.makeDirectory(iconCachePath) filesystem.makeDirectory(iconCachePath)
local iconsCache = {} local iconsCache = {}
@ -112,7 +204,7 @@ local leftList = window:addChild(GUI.list(1, 4, leftListPanel.width, 1, 3, 0, ni
local contentContainer = window:addChild(GUI.container(1, 1, 1, 1)) local contentContainer = window:addChild(GUI.container(1, 1, 1, 1))
local progressIndicator = window:addChild(GUI.progressIndicator(math.floor(leftListPanel.width / 2 - 1), 1, 0x3C3C3C, 0x996D00, 0xFFDB40)) local progressIndicator = window:addChild(GUI.progressIndicator(math.floor(leftListPanel.width / 2 - 1), 1, 0x3C3C3C, 0x332480, 0x5100FF))
window.actionButtons.localX = 3 window.actionButtons.localX = 3
window.actionButtons:moveToFront() window.actionButtons:moveToFront()
@ -2001,7 +2093,7 @@ local function leftListItemDraw(pressable)
local textColor = pressable.pressed and pressable.colors.pressed.text or pressable.colors.default.text local textColor = pressable.pressed and pressable.colors.pressed.text or pressable.colors.default.text
if pressable.pressed then if pressable.pressed then
screen.drawRectangle(pressable.x, pressable.y, 1, pressable.height, backgroundColor, 0xFFDB80, "") screen.drawRectangle(pressable.x, pressable.y, 1, pressable.height, backgroundColor, 0x5100FF, "")
screen.drawRectangle(pressable.x + 1, pressable.y, pressable.width - 1, pressable.height, backgroundColor, textColor, " ") screen.drawRectangle(pressable.x + 1, pressable.y, pressable.width - 1, pressable.height, backgroundColor, textColor, " ")
end end

Binary file not shown.

View File

@ -136,9 +136,9 @@ displayWidget.draw = function()
end end
-- Char -- Char
screen.drawText(displayWidget.x, y, 0x696969, "\"") screen.drawText(displayWidget.x, y, 0x696969, ((absValue >= 0 and absValue <= 65535) and "\'" or "")) -- fixed that stupid bug I posted on the main github
screen.drawText(displayWidget.x + 1, y, 0xFFFFFF, charList.selectedItem == 1 and unicode.char(absValue) or (absValue < 256 and string.char(absValue) or "?")) screen.drawText(displayWidget.x + 1, y, 0xFFFFFF, ((absValue >= 0 and absValue <= 65535) and (charList.selectedItem == 1 and unicode.char(absValue) or (absValue < 256 and string.char(absValue) or "?")) or ""))
screen.drawText(displayWidget.x + 2, y, 0x696969, "\"") screen.drawText(displayWidget.x + 2, y, 0x696969, ((absValue >= 0 and absValue <= 65535) and "\'" or ""))
end end
local function setValueRaw(v) local function setValueRaw(v)
@ -291,7 +291,7 @@ local function addRegularButton(x, y, ...)
end end
local function addMathButton(x, y, ...) local function addMathButton(x, y, ...)
return addButton(x, y, 0xFF9240, 0xFFFFFF, 0xCC6D00, 0xFFFFFF, ...) return addButton(x, y, 0x4E00FF, 0xFFFFFF, 0x330080, 0xFFFFFF, ...)
end end
local function onDigitPressed(digit) local function onDigitPressed(digit)

Binary file not shown.

View File

@ -124,7 +124,7 @@ local function renderMonth(xCoord, yCoord, width, monthPos)
local weekText = config.isWeekAlt and localization.weekLineAlt or localization.weekLine local weekText = config.isWeekAlt and localization.weekLineAlt or localization.weekLine
local xStart = math.floor(xCoord + width / 2 - unicode.len(weekText) / 2) local xStart = math.floor(xCoord + width / 2 - unicode.len(weekText) / 2)
screen.drawText(math.floor(xCoord + width / 2 - unicode.len(text) / 2), yCoord, 0xFF0000, text) screen.drawText(math.floor(xCoord + width / 2 - unicode.len(text) / 2), yCoord, 0x4E00FF, text)
screen.drawText(xStart, yCoord + 2, 0x888888, weekText) screen.drawText(xStart, yCoord + 2, 0x888888, weekText)
if not curYearList or selectedYear ~= lastCountedYear then if not curYearList or selectedYear ~= lastCountedYear then
@ -138,7 +138,7 @@ local function renderMonth(xCoord, yCoord, width, monthPos)
end end
for i=1, curYearList[monthPos].countOfDays do for i=1, curYearList[monthPos].countOfDays do
local numColor = (config.isWeekAlt and (counter == 0 or counter == 6) and 0xFF0000) or (not config.isWeekAlt and counter > 4 and 0xFF0000) or 0x262626 local numColor = (config.isWeekAlt and (counter == 0 or counter == 6) and 0x4E00FF) or (not config.isWeekAlt and counter > 4 and 0x4E00FF) or 0x262626
if selectedYear == currentYear and monthPos == currentMonth and i == currentDay then if selectedYear == currentYear and monthPos == currentMonth and i == currentDay then
screen.drawText(xStart + (counter * 4) - 1, yCoord + line - 1, 0xD2D2D2, '⢀▄▄⡀') screen.drawText(xStart + (counter * 4) - 1, yCoord + line - 1, 0xD2D2D2, '⢀▄▄⡀')