Skip to content

Commit

Permalink
Merge branch 'master' into clean-up-changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethloeffler committed Sep 23, 2023
2 parents 513dd06 + bb8dd14 commit 2cf5a13
Show file tree
Hide file tree
Showing 109 changed files with 1,209 additions and 647 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# stylua formatting
0f8e1625d572a5fe0f7b5c08653ff92cc837d346
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
run: cargo test --locked --verbose

lint:
name: Rustfmt and Clippy
name: Rustfmt, Clippy, & Stylua
runs-on: ubuntu-latest

steps:
Expand All @@ -62,6 +62,9 @@ jobs:
with:
version: 'v0.2.7'

- name: Stylua
run: stylua --check plugin/src

- name: Rustfmt
run: cargo fmt -- --check

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
#### Project format
* Added support for `.toml` files to `$path` ([#633])
* Added support for `Font` and `CFrame` attributes ([rbx-dom#299], [rbx-dom#296])
* Added the `emitLegacyScripts` field to the project format ([#765]). The behavior is outlined below:

| `emitLegacyScripts` Value | Action Taken by Rojo |
|---------------------------|------------------------------------------------------------------------------------------------------------------|
| false | Rojo emits Scripts with the appropriate `RunContext` for `*.client.lua` and `*.server.lua` files in the project. |
| true (default) | Rojo emits LocalScripts and Scripts with legacy `RunContext` (same behavior as previously). |

* Added `Terrain` classname inference, similar to services ([#771])

`Terrain` may now be defined in projects without using `$className`:
Expand Down Expand Up @@ -126,6 +133,7 @@
[#738]: https://github.com/rojo-rbx/rojo/pull/738
[#748]: https://github.com/rojo-rbx/rojo/pull/748
[#755]: https://github.com/rojo-rbx/rojo/pull/755
[#765]: https://github.com/rojo-rbx/rojo/pull/765
[#770]: https://github.com/rojo-rbx/rojo/pull/770
[#771]: https://github.com/rojo-rbx/rojo/pull/771
[#774]: https://github.com/rojo-rbx/rojo/pull/774
Expand Down
3 changes: 2 additions & 1 deletion aftman.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[tools]
rojo = "rojo-rbx/[email protected]"
selene = "Kampfkarren/[email protected]"
selene = "Kampfkarren/[email protected]"
stylua = "JohnnyMorganz/[email protected]"
run-in-roblox = "rojo-rbx/[email protected]"
104 changes: 45 additions & 59 deletions plugin/src/ApiContext.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@ end
local function rejectWrongProtocolVersion(infoResponseBody)
if infoResponseBody.protocolVersion ~= Config.protocolVersion then
local message = (
"Found a Rojo dev server, but it's using a different protocol version, and is incompatible." ..
"\nMake sure you have matching versions of both the Rojo plugin and server!" ..
"\n\nYour client is version %s, with protocol version %s. It expects server version %s." ..
"\nYour server is version %s, with protocol version %s." ..
"\n\nGo to https://github.com/rojo-rbx/rojo for more details."
"Found a Rojo dev server, but it's using a different protocol version, and is incompatible."
.. "\nMake sure you have matching versions of both the Rojo plugin and server!"
.. "\n\nYour client is version %s, with protocol version %s. It expects server version %s."
.. "\nYour server is version %s, with protocol version %s."
.. "\n\nGo to https://github.com/rojo-rbx/rojo for more details."
):format(
Version.display(Config.version), Config.protocolVersion,
Version.display(Config.version),
Config.protocolVersion,
Config.expectedServerVersionString,
infoResponseBody.serverVersion, infoResponseBody.protocolVersion
infoResponseBody.serverVersion,
infoResponseBody.protocolVersion
)

return Promise.reject(message)
Expand All @@ -59,14 +61,11 @@ local function rejectWrongPlaceId(infoResponseBody)
end

local message = (
"Found a Rojo server, but its project is set to only be used with a specific list of places." ..
"\nYour place ID is %s, but needs to be one of these:" ..
"\n%s" ..
"\n\nTo change this list, edit 'servePlaceIds' in your .project.json file."
):format(
tostring(game.PlaceId),
table.concat(idList, "\n")
)
"Found a Rojo server, but its project is set to only be used with a specific list of places."
.. "\nYour place ID is %s, but needs to be one of these:"
.. "\n%s"
.. "\n\nTo change this list, edit 'servePlaceIds' in your .project.json file."
):format(tostring(game.PlaceId), table.concat(idList, "\n"))

return Promise.reject(message)
end
Expand Down Expand Up @@ -141,18 +140,15 @@ end
function ApiContext:read(ids)
local url = ("%s/api/read/%s"):format(self.__baseUrl, table.concat(ids, ","))

return Http.get(url)
:andThen(rejectFailedRequests)
:andThen(Http.Response.json)
:andThen(function(body)
if body.sessionId ~= self.__sessionId then
return Promise.reject("Server changed ID")
end
return Http.get(url):andThen(rejectFailedRequests):andThen(Http.Response.json):andThen(function(body)
if body.sessionId ~= self.__sessionId then
return Promise.reject("Server changed ID")
end

assert(validateApiRead(body))
assert(validateApiRead(body))

return body
end)
return body
end)
end

function ApiContext:write(patch)
Expand Down Expand Up @@ -189,28 +185,24 @@ function ApiContext:write(patch)

body = Http.jsonEncode(body)

return Http.post(url, body)
:andThen(rejectFailedRequests)
:andThen(Http.Response.json)
:andThen(function(body)
Log.info("Write response: {:?}", body)
return Http.post(url, body):andThen(rejectFailedRequests):andThen(Http.Response.json):andThen(function(body)
Log.info("Write response: {:?}", body)

return body
end)
return body
end)
end

function ApiContext:retrieveMessages()
local url = ("%s/api/subscribe/%s"):format(self.__baseUrl, self.__messageCursor)

local function sendRequest()
local request = Http.get(url)
:catch(function(err)
if err.type == Http.Error.Kind.Timeout and self.__connected then
return sendRequest()
end
local request = Http.get(url):catch(function(err)
if err.type == Http.Error.Kind.Timeout and self.__connected then
return sendRequest()
end

return Promise.reject(err)
end)
return Promise.reject(err)
end)

Log.trace("Tracking request {}", request)
self.__activeRequests[request] = true
Expand All @@ -222,35 +214,29 @@ function ApiContext:retrieveMessages()
end)
end

return sendRequest()
:andThen(rejectFailedRequests)
:andThen(Http.Response.json)
:andThen(function(body)
if body.sessionId ~= self.__sessionId then
return Promise.reject("Server changed ID")
end
return sendRequest():andThen(rejectFailedRequests):andThen(Http.Response.json):andThen(function(body)
if body.sessionId ~= self.__sessionId then
return Promise.reject("Server changed ID")
end

assert(validateApiSubscribe(body))
assert(validateApiSubscribe(body))

self:setMessageCursor(body.messageCursor)
self:setMessageCursor(body.messageCursor)

return body.messages
end)
return body.messages
end)
end

function ApiContext:open(id)
local url = ("%s/api/open/%s"):format(self.__baseUrl, id)

return Http.post(url, "")
:andThen(rejectFailedRequests)
:andThen(Http.Response.json)
:andThen(function(body)
if body.sessionId ~= self.__sessionId then
return Promise.reject("Server changed ID")
end
return Http.post(url, ""):andThen(rejectFailedRequests):andThen(Http.Response.json):andThen(function(body)
if body.sessionId ~= self.__sessionId then
return Promise.reject("Server changed ID")
end

return nil
end)
return nil
end)
end

return ApiContext
21 changes: 11 additions & 10 deletions plugin/src/App/Components/Checkbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ end

function Checkbox:didUpdate(lastProps)
if lastProps.active ~= self.props.active then
self.motor:setGoal(
Flipper.Spring.new(self.props.active and 1 or 0, {
frequency = 6,
dampingRatio = 1.1,
})
)
self.motor:setGoal(Flipper.Spring.new(self.props.active and 1 or 0, {
frequency = 6,
dampingRatio = 1.1,
}))
end
end

Expand All @@ -52,13 +50,14 @@ function Checkbox:render()
BackgroundTransparency = 1,

[Roact.Event.Activated] = function()
if self.props.locked then return end
if self.props.locked then
return
end
self.props.onClick()
end,
}, {
StateTip = e(Tooltip.Trigger, {
text =
(if self.props.locked then "[LOCKED] " else "")
text = (if self.props.locked then "[LOCKED] " else "")
.. (if self.props.active then "Enabled" else "Disabled"),
}),

Expand Down Expand Up @@ -89,7 +88,9 @@ function Checkbox:render()
size = UDim2.new(1, 0, 1, 0),
}, {
Icon = e("ImageLabel", {
Image = if self.props.locked then Assets.Images.Checkbox.Locked else Assets.Images.Checkbox.Inactive,
Image = if self.props.locked
then Assets.Images.Checkbox.Locked
else Assets.Images.Checkbox.Inactive,
ImageColor3 = theme.Inactive.IconColor,
ImageTransparency = self.props.transparency,

Expand Down
2 changes: 1 addition & 1 deletion plugin/src/App/Components/CodeLabel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function CodeLabel:didMount()
end

function CodeLabel:didUpdate()
self:updateHighlights()
self:updateHighlights()
end

function CodeLabel:updateHighlights()
Expand Down
Loading

0 comments on commit 2cf5a13

Please sign in to comment.