From 1316d6a3c906eb1dcc0323982b46f655777ee628 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Sat, 23 Jan 2021 14:58:08 +0000 Subject: [PATCH] Migrate all examples to use tweaked.cc Might as well, I've got the server capacity to spare. Hopefully. --- doc/events/http_failure.md | 2 +- doc/events/websocket_closed.md | 2 +- doc/events/websocket_failure.md | 2 +- doc/events/websocket_message.md | 2 +- doc/events/websocket_success.md | 2 +- doc/stub/http.lua | 6 +++--- .../core/apis/http/request/HttpResponseHandle.java | 4 ++-- src/main/resources/data/computercraft/lua/rom/motd.txt | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/events/http_failure.md b/doc/events/http_failure.md index d7572e601..dc10b40d7 100644 --- a/doc/events/http_failure.md +++ b/doc/events/http_failure.md @@ -16,7 +16,7 @@ ## Return Values ## Example Prints an error why the website cannot be contacted: ```lua -local myURL = "http://this.website.does.not.exist" +local myURL = "https://does.not.exist.tweaked.cc" http.request(myURL) local event, url, err repeat diff --git a/doc/events/websocket_closed.md b/doc/events/websocket_closed.md index 60a8f59c2..9e3783d19 100644 --- a/doc/events/websocket_closed.md +++ b/doc/events/websocket_closed.md @@ -11,7 +11,7 @@ ## Return Values ## Example Prints a message when a WebSocket is closed (this may take a minute): ```lua -local myURL = "ws://echo.websocket.org" +local myURL = "wss://example.tweaked.cc/echo" local ws = http.websocket(myURL) local event, url repeat diff --git a/doc/events/websocket_failure.md b/doc/events/websocket_failure.md index f53bf10af..eef34e777 100644 --- a/doc/events/websocket_failure.md +++ b/doc/events/websocket_failure.md @@ -15,7 +15,7 @@ ## Return Values ## Example Prints an error why the website cannot be contacted: ```lua -local myURL = "ws://this.website.does.not.exist" +local myURL = "wss://example.tweaked.cc/not-a-websocket" http.websocketAsync(myURL) local event, url, err repeat diff --git a/doc/events/websocket_message.md b/doc/events/websocket_message.md index f42dcaefe..53b9d4bd2 100644 --- a/doc/events/websocket_message.md +++ b/doc/events/websocket_message.md @@ -14,7 +14,7 @@ ## Return Values ## Example Prints a message sent by a WebSocket: ```lua -local myURL = "ws://echo.websocket.org" +local myURL = "wss://example.tweaked.cc/echo" local ws = http.websocket(myURL) ws.send("Hello!") local event, url, message diff --git a/doc/events/websocket_success.md b/doc/events/websocket_success.md index dc8d95dd2..dcde934b3 100644 --- a/doc/events/websocket_success.md +++ b/doc/events/websocket_success.md @@ -15,7 +15,7 @@ ## Return Values ## Example Prints the content of a website (this may fail if the request fails): ```lua -local myURL = "ws://echo.websocket.org" +local myURL = "wss://example.tweaked.cc/echo" http.websocketAsync(myURL) local event, url, handle repeat diff --git a/doc/stub/http.lua b/doc/stub/http.lua index 6854ac9ea..28d04d648 100644 --- a/doc/stub/http.lua +++ b/doc/stub/http.lua @@ -58,10 +58,10 @@ function request(...) end -- @treturn string A message detailing why the request failed. -- @treturn Response|nil The failing http response, if available. -- --- @usage Make a request to [example.computercraft.cc](https://example.computercraft.cc), +-- @usage Make a request to [example.tweaked.cc](https://example.tweaked.cc), -- and print the returned page. -- ```lua --- local request = http.get("https://example.computercraft.cc") +-- local request = http.get("https://example.tweaked.cc") -- print(request.readAll()) -- -- => HTTP is working! -- request.close() @@ -123,7 +123,7 @@ function checkURLAsync(url) end -- -- @usage -- ```lua --- print(http.checkURL("https://example.computercraft.cc/")) +-- print(http.checkURL("https://example.tweaked.cc/")) -- -- => true -- print(http.checkURL("http://localhost/")) -- -- => false Domain not permitted diff --git a/src/main/java/dan200/computercraft/core/apis/http/request/HttpResponseHandle.java b/src/main/java/dan200/computercraft/core/apis/http/request/HttpResponseHandle.java index 5ab40814d..c5d72134b 100644 --- a/src/main/java/dan200/computercraft/core/apis/http/request/HttpResponseHandle.java +++ b/src/main/java/dan200/computercraft/core/apis/http/request/HttpResponseHandle.java @@ -58,10 +58,10 @@ public final Object[] getResponseCode() * If multiple headers are sent with the same name, they will be combined with a comma. * * @return The response's headers. - * @cc.usage Make a request to [example.computercraft.cc](https://example.computercraft.cc), and print the + * @cc.usage Make a request to [example.tweaked.cc](https://example.tweaked.cc), and print the * returned headers. *
{@code
-     * local request = http.get("https://example.computercraft.cc")
+     * local request = http.get("https://example.tweaked.cc")
      * print(textutils.serialize(request.getResponseHeaders()))
      * -- => {
      * --  [ "Content-Type" ] = "text/plain; charset=utf8",
diff --git a/src/main/resources/data/computercraft/lua/rom/motd.txt b/src/main/resources/data/computercraft/lua/rom/motd.txt
index 8c8f16945..1745d4ee3 100644
--- a/src/main/resources/data/computercraft/lua/rom/motd.txt
+++ b/src/main/resources/data/computercraft/lua/rom/motd.txt
@@ -1,5 +1,5 @@
 Please report bugs at https://github.com/SquidDev-CC/CC-Tweaked. Thanks!
-View the documentation at https://wiki.computercraft.cc
+View the documentation at https://tweaked.cc
 Show off your programs or ask for help at our forum: https://forums.computercraft.cc
 You can disable these messages by running "set motd.enable false".
 Use "pastebin put" to upload a program to pastebin.