mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-08-11 20:20:35 +00:00
Lock 'Check for Updates' setting if user blocks access to api.github.com (#1297)
This commit is contained in:
@@ -34,8 +34,10 @@ Making a new release? Simply add the new header with the version and date undern
|
|||||||
* Fixed `$path` values that point outside the project folder failing to match `syncRule`s on Windows, which broke `rojo sourcemap` with a "could not be turned into a Roblox Instance" error. ([#1290])
|
* Fixed `$path` values that point outside the project folder failing to match `syncRule`s on Windows, which broke `rojo sourcemap` with a "could not be turned into a Roblox Instance" error. ([#1290])
|
||||||
* Fixed `rojo serve` silently stopping syncing file changes on Windows when the served project path was a verbatim (`\\?\`) path, because tree paths and file-watcher event paths were canonicalized to different forms. ([#1290])
|
* Fixed `rojo serve` silently stopping syncing file changes on Windows when the served project path was a verbatim (`\\?\`) path, because tree paths and file-watcher event paths were canonicalized to different forms. ([#1290])
|
||||||
* Fixed `rojo sourcemap --absolute` emitting verbatim (`\\?\`) paths on Windows, which broke require types in luau-lsp. ([#1290])
|
* Fixed `rojo sourcemap --absolute` emitting verbatim (`\\?\`) paths on Windows, which broke require types in luau-lsp. ([#1290])
|
||||||
|
* The plugin now disables the `Check for Updates` setting if you block access to `api.github.com`. ([#1297])
|
||||||
|
|
||||||
[#1290]: https://github.com/rojo-rbx/rojo/pull/1290
|
[#1290]: https://github.com/rojo-rbx/rojo/pull/1290
|
||||||
|
[#1297]: https://github.com/rojo-rbx/rojo/pull/1297
|
||||||
|
|
||||||
## [7.7.0] (July 1st, 2026)
|
## [7.7.0] (July 1st, 2026)
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ local Log = require(Packages.Log)
|
|||||||
local Assets = require(Plugin.Assets)
|
local Assets = require(Plugin.Assets)
|
||||||
local Settings = require(Plugin.Settings)
|
local Settings = require(Plugin.Settings)
|
||||||
local Theme = require(Plugin.App.Theme)
|
local Theme = require(Plugin.App.Theme)
|
||||||
|
local Version = require(Plugin.Version)
|
||||||
|
|
||||||
local IconButton = require(Plugin.App.Components.IconButton)
|
local IconButton = require(Plugin.App.Components.IconButton)
|
||||||
local ScrollingFrame = require(Plugin.App.Components.ScrollingFrame)
|
local ScrollingFrame = require(Plugin.App.Components.ScrollingFrame)
|
||||||
@@ -193,6 +194,8 @@ function SettingsPage:render()
|
|||||||
id = "checkForUpdates",
|
id = "checkForUpdates",
|
||||||
name = "Check For Updates",
|
name = "Check For Updates",
|
||||||
description = "Notify about newer compatible Rojo releases",
|
description = "Notify about newer compatible Rojo releases",
|
||||||
|
locked = Version.isApiBlocked(),
|
||||||
|
lockedTooltip = "(HTTP requests to api.github.com are blocked, Rojo cannot fetch what the latest version is.)",
|
||||||
transparency = self.props.transparency,
|
transparency = self.props.transparency,
|
||||||
layoutOrder = layoutIncrement(),
|
layoutOrder = layoutIncrement(),
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -111,6 +111,24 @@ Version._cachedLatestCompatible = nil :: {
|
|||||||
timestamp: number,
|
timestamp: number,
|
||||||
}?
|
}?
|
||||||
|
|
||||||
|
--[[
|
||||||
|
A user may choose to reject requests to api.github.com. If they do, we want
|
||||||
|
to disable the setting for checking for updates to indicate that it does
|
||||||
|
nothing.
|
||||||
|
]]
|
||||||
|
Version._apiBlocked = nil :: boolean?
|
||||||
|
|
||||||
|
function Version.isApiBlocked(): boolean
|
||||||
|
if Version._apiBlocked == nil then
|
||||||
|
local isLocalInstall = string.find(debug.traceback(), "\n[^\n]-user_.-$") ~= nil
|
||||||
|
Version.retrieveLatestCompatible({
|
||||||
|
version = Config.version,
|
||||||
|
includePrereleases = isLocalInstall and Settings:get("checkForPrereleases"),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
return Version._apiBlocked
|
||||||
|
end
|
||||||
|
|
||||||
function Version.retrieveLatestCompatible(options: {
|
function Version.retrieveLatestCompatible(options: {
|
||||||
version: { number },
|
version: { number },
|
||||||
includePrereleases: boolean?,
|
includePrereleases: boolean?,
|
||||||
@@ -136,8 +154,13 @@ function Version.retrieveLatestCompatible(options: {
|
|||||||
:await()
|
:await()
|
||||||
|
|
||||||
if success == false or type(releases) ~= "table" or next(releases) ~= 1 then
|
if success == false or type(releases) ~= "table" or next(releases) ~= 1 then
|
||||||
|
-- Roblox's HTTP errors are weird!
|
||||||
|
if string.find(tostring(releases), "^Unknown HTTP error: HttpService permission denied") then
|
||||||
|
Version._apiBlocked = true
|
||||||
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
Version._apiBlocked = false
|
||||||
|
|
||||||
-- Iterate through releases, looking for the latest compatible version
|
-- Iterate through releases, looking for the latest compatible version
|
||||||
local latestCompatible: LatestReleaseInfo? = nil
|
local latestCompatible: LatestReleaseInfo? = nil
|
||||||
|
|||||||
Reference in New Issue
Block a user