※下の方に、この解説の日本語版もあります
Just to be clear, let me explain about the Outvoke sample code samples/2024/webrick_vrchat_instanceinfo.html that was set up on GitLab Pages.
This explanation is current as of December 10, 2024. It assumes that the Ruby version is 3.x and the Outvoke version is 0.1 (including 0.0.99.x). The Japanese version of this explanation was written first. In the event of any discrepancies in content, the original Japanese version shall prevail.
The "sample" mentioned here does not refer to the free version under the circumstances where both paid and free versions are available. It refers to an example of using Outvoke.
When I say the page that was set up on GitLab Pages, I mean https://cleemy-desu-wayo.gitlab.io/ov/webrick_vrchat_instanceinfo.html as the URL.
The only thing you get by using the page at the above URL is that you can be sure that it is possible to actually operate cross-domain cooperatively. If the purpose is to use it as a tool to display real-time information about the instance you are in, there is no merit in continuing to use it as a daily use item.
Here are the steps to make it work for those who want to see if it actually works.
What I have written here has little to do with the essence of Outvoke. However, if you get a general feel for what is written here, it may be easier to guess the intent of the code when you see Outvoke samples that use JSON. Also, it might be easier to imagine how to place something that outputs JSON when you try to write your own script that uses Outvoke.
Note that the assumption is that your environment is Linux with Ruby, and that VRChat running on Proton GE or similar is already installed. The author (cleemy desu wayo) has not tested if it works on WSL.
In fact, all that is required is that the VRChat client log files be readable through the OS file system, not necessarily that the VRChat itself be installed on the same machine.
This explanation is written in a verbose manner, with the assumption that there may be some readers who are not familiar with web technologies or who are beginners in programming. Even if you are a beginner in programming itself, it is assumed that you can search for error messages and other information yourself and determine the cause to some extent on your own.
If you are still not satisfied even after researching, or if you cannot figure out what the error is no matter how much you search, please feel free to send me a message via Odaibako ( https://odaibako.net/u/cleemy_desu_wayo ).
First, by using your web browser, try accessing https://cleemy-desu-wayo.gitlab.io/ov/webrick_vrchat_instanceinfo.html that was set up on GitLab Pages.
Click on the "dummy" button at the bottom to see if dummy information is displayed.
If the dummy data is successfully loaded, the number in the upper left corner of the page should be "21".
If you do not see the dummy data here, this sample code may not be available in your browser. Alternatively, there may be browser plug-ins or security-related tools that are intervening.
By the way, the contents of this dummy data are all completely fake except for those related to the username "cleemy".
The dummy data is just a text file (static data) placed at https://cleemy-desu-wayo.gitlab.io/ov/webrick_vrchat_instanceinfo_dummy.json.txt.
It is normal behavior to see a large "error" message and no instance information to be displayed immediately after the page is displayed or immediately after pressing the "default" button. If you have not set up your own endpoint on localhost, but the actual information is displayed instead of the "error", then it can be considered that something bizarre is going on.
Two Ruby scripts are required to set up your own endpoints to deliver JSON.
First, create a new directory and move to it.
Download the latest version of outvoke.rb (Outvoke itself) to the current directory.
$ wget https://gitlab.com/cleemy-desu-wayo/outvoke/-/raw/main/outvoke.rb
Also download the latest version of webrick_vrchat_instanceinfo.rb to the current directory.
$ wget https://gitlab.com/cleemy-desu-wayo/outvoke/-/raw/main/samples/2024/webrick_vrchat_instanceinfo.rb
And as for outvoke.rb, grant execution permission.
$ chmod 705 outvoke.rb
Then try to launch Outvoke itself as follows:
$ ./outvoke.rb -e hooksec
If the output increases by one line per second, as shown below, it means that the Outvoke itself has completed starting.
# starting Outvoke 0.1 (version 0.0.99.20241206) ---- 2024-12-09 10:58:32 +0900
# ----
# given ruby code:
# hooksec
# ----
[2024-12-09 10:58:33 +0900] 2024-12-09 10:58:33 +0900
[2024-12-09 10:58:34 +0900] 2024-12-09 10:58:34 +0900
[2024-12-09 10:58:35 +0900] 2024-12-09 10:58:35 +0900
[2024-12-09 10:58:36 +0900] 2024-12-09 10:58:36 +0900
[2024-12-09 10:58:37 +0900] 2024-12-09 10:58:37 +0900
Once you have confirmed that it can be launched, terminate it with Ctrl + C.
If the startup fails, you need to pay attention to the error messages and resolve the problem before going to the next step.
It is also possible that the latest version of Outvoke has a new bug in it. If you dare to try a slightly older version of Outvoke, you can find it at https://gitlab.com/cleemy-desu-wayo/outvoke/-/commits/main/outvoke.rb.
Start VRChat and now launch Outvoke as follows this time:
$ ./outvoke.rb -e 'hook("vrchat-001", /entering room/i)'
If there are no errors, try moving to another world in VRChat with Outvoke still running.
If the world name of the new world is output each time you move, as shown below, it can be considered that Outvoke is able to read the log files output by the VRChat client.
# starting Outvoke 0.1 (version 0.0.99.20241206) ---- 2024-12-09 11:02:40 +0900
# ----
# given ruby code:
# hook("vrchat-001", /entering room/i)
# ----
[2024-12-09 11:02:40 +0900] [outvoke-system] vrchat-001: a new log file was found.
[2024-12-09 11:02:40 +0900] [outvoke-system] vrchat-001: first time log check has done.
[2024-12-09 11:04:08 +0900] [Behaviour] Entering Room: Beyond a bit - 想像のちょっと先へ
[2024-12-09 11:05:35 +0900] [Behaviour] Entering Room: Japan Street 0․430
[2024-12-09 11:08:20 +0900] [Behaviour] Entering Room: Moonlit Perch -月明かりの泊まり木-
[2024-12-09 11:08:46 +0900] [Behaviour] Entering Room: Moonlit Perch -月明かりの泊まり木-
[2024-12-09 11:10:48 +0900] [Behaviour] Entering Room: Xen Hall
[2024-12-09 11:13:20 +0900] [Behaviour] Entering Room: Cyber Chill Out Room
Once you have confirmed that it can be read, terminate Outvoke with Ctrl + C.
If you get errors, you need to pay attention to the error messages and resolve the problem before going to the next step.
If you see no error but no output of world names, you will still need to identify the cause before going to the next step.
If you see the error output "ERROR: VRChat log file not found" like as following, you may need to explicitly specify the directory where the log files are located.
[2024-12-09 14:01:21 +0900] [outvoke-system] vrchat-001: ERROR: VRChat log file not found
See README.md for instructions on how to explicitly specify the directory where VRChat log files are located.
The word "delivery" here simply means that the JSON data for your own use is ready to be returned in response to HTTP requests from your own computer.
Start VRChat, and now launch Outvoke as follows. The assumption is that port 8080 is free.
$ ./outvoke.rb webrick_vrchat_instanceinfo.rb
The "-e" option is one-liner mode, but when launched as above, it attempts to read and execute a script file.
If it fails to start, you should still pay attention to the error message and resolve the issue before going to the next step. In some cases you may need to manually install the Ruby library WEBrick.
If it appears to be running, try accessing it via HTTP. The Outvoke that you just started needs to remain running, so execute the following from another terminal.
$ wget http://localhost:8080/outvoke-vrchat-instanceinfo -q -S -O -
Once you have confirmed that JSON data is output to standard output along with HTTP response headers as shown below, for now, you can say that JSON data delivery is possible.
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Vary: Origin
Cache-Control: no-store
Pragma: no-cache
Server: WEBrick/1.7.0 (Ruby/3.0.2/2021-07-07)
Date: Mon, 09 Dec 2024 02:18:04 GMT
Content-Length: 230
Connection: Keep-Alive
{
"world": {
"name": "Cyber Chill Out Room",
"id": "wrld_dc80e8f2-5d48-4bdd-b7f4-3faca6678833",
"instance": "32470",
"region": "jp"
},
"users": {
"usr_eced6a32-b25c-43ae-87aa-ab36c0eee2c5": "cleemy"
}
}
As you can see by moving to another world in VRChat and then do wget again, it should always return the latest information each time you access it.
If you are using a PC behind a typical broadband router, it does not mean that it is accessible from the outside (WAN side) unless you have intentionally configured it that way. It just means that there is an endpoint that responds to requests from local.
By the way, if you want to use a port other than 8080, create a file named outvoke.conf.rb in the current directory and include a line like the following:
$webrick_instanceinfo_port = 8081
Note that the "$" above is not "$" at the terminal prompt, but the "$" indicates that it is a Ruby global variable.
If you are ready to get JSON data via wget, the goal is in sight.
However, to make JSON available from samples/2024/webrick_vrchat_instanceinfo.html placed on GitLab Pages ( https://cleemy-desu-wayo.gitlab.io/ov/webrick_vrchat_instanceinfo.html ), you need to configure CORS to share resources between different domains in modern web browsers.
CORS (Cross-Origin Resource Sharing) is a specification that became a W3C Recommendation in January 2014.
Basically, keep in mind that setting up CORS in the way shown here means adding new path for malicious persons to try to illegally read information.
To configure this, create a file named outvoke.conf.rb in the current directory. If this file does not already exist, make it contain just the following single line. If the file already exists, add the following line at the end.
$webrick_instanceinfo_cors_list = ["https://cleemy-desu-wayo.gitlab.io"]
Only those with a deep understanding of CORS should set a value other than the above. Be especially careful when setting "*".
And note that the "$" above is not "$" at the terminal prompt, but the "$" indicates that it is a Ruby global variable.
Once outvoke.conf.rb has been created, if Outvoke is still running, exit it. And then try launch again as follows:
$ ./outvoke.rb webrick_vrchat_instanceinfo.rb
If you were able to start up Outvoke before, but it will no longer start up after you created outvoke.conf.rb, there is an incorrect part somewhere in outvoke.conf.rb.
Once launched, try HTTP access with an Origin header as shown below.
$ wget http://localhost:8080/outvoke-vrchat-instanceinfo -q -S -O - --header="Origin: https://cleemy-desu-wayo.gitlab.io"
When an HTTP request includes an Origin header, if a line beginning "Access-Control-Allow-Origin:" is added in the response header as follows, then it is considered that CORS has been well configured.
Access-Control-Allow-Origin: https://cleemy-desu-wayo.gitlab.io
If there is no line starting with "Access-Control-Allow-Origin:" in the response header, you will need to identify the cause.
If your CORS settings seem to be working, try accessing https://cleemy-desu-wayo.gitlab.io/ov/webrick_vrchat_instanceinfo.html using your web browser. There may be cases where you need to refresh the page with "F5" or press the "default" button. Also, if the port is not 8080, you will need to change the "JSON data URL:" input field.
It is successful if information about the current instance is displayed instead of "error".
By the way, the CORS configuration method explained here is specific to samples/2024/webrick_vrchat_instanceinfo.rb.
Now, let's go back to my first point about "there is no merit in continuing to use it".
If you follow the steps explained so far, the JSON data is delivered at localhost:8080. Therefore, you can also use samples/2024/webrick_vrchat_instanceinfo.html by placing it at localhost:8080.
In other words, all you need to do is put the latest version of webrick_vrchat_instanceinfo.html in the directory you have just created.
$ wget https://gitlab.com/cleemy-desu-wayo/outvoke/-/raw/main/samples/2024/webrick_vrchat_instanceinfo.html
If you visit http://localhost:8080/webrick_vrchat_instanceinfo.html using your web browser under the circumstances where JSON delivery is possible (where the previous Outvoke process running), a localhost version of webrick_vrchat_instanceinfo.html should be available.
In this case, there is no need to configure CORS. Both the side that reads JSON and the side that delivers JSON are placed at localhost:8080. It is safer to delete the outvoke.conf.rb file that was just prepared.
Generally speaking, if an application that has characteristics of a SPA is updated frequently, it is beneficial to put it on GitLab Pages or similar. This is because the latest version is always available as long as you have access to it. However, samples/2024/webrick_vrchat_instanceinfo.html is just a sample program and is not updated often.
That's all the explanation from me for now.
If you have any questions, you can use Odaibako ( https://odaibako.net/u/cleemy_desu_wayo ).
GitLab Pages 上に置いたOutvokeのサンプルコード samples/2024/webrick_vrchat_instanceinfo.html について、念のために解説しておきます。
この解説は2024年12月10日時点のものです。Rubyのバージョンは3.xで、Outvokeのバージョンは0.1(0.0.99.x を含む)を想定しています。この解説は日本語版を先に書いています。内容に食い違いがある場合は、オリジナルの日本語版の記述を優先させてください。
ここで言う「サンプル」というのは、有料版と無料版が用意されている状況での無料版のほうという意味ではなく、作例(an example of using Outvoke)ということです。
GitLab Pages 上に置いたものというのは、URLとしては https://cleemy-desu-wayo.gitlab.io/ov/webrick_vrchat_instanceinfo.html のことです。
上記のURLのものは、実際にクロスドメインで協調的に動作させるのが可能ということを確認できるだけです。自分のいるインスタンスの情報をリアルタイム表示するためのツールとして使うという目的であれば、普段使いのものとして継続的に使用するメリットはありません。
ここでは実際に動作するのかどうかを確認したいという人のために、動作させるまでの手順を示しておきます。
ここに書いたことは、Outvokeの本質とはあまり関係はありません。ただ、ここに書かれていることについての全体的な感触をつかんでおけば、Outvokeのサンプルの中でJSONを利用したものがあった時に、そのコードの意図が推測しやすくなるということはあるかもしれません。また、Outvokeを利用したスクリプトを自分で書こうとした時に、JSONを出力するようなものをどのように配置すればいいかがイメージしやすくなるかもしれません。
なお、お手元の環境はRubyが入っているLinuxで、そこに Proton GE などの上で動くVRChatがすでにインストールされているというのが前提です。WSLでも動くかどうかについては、作者(cleemy desu wayo)は試していません。
実際のところ、必要なのはVRChatクライアントのログファイルがOSのファイルシステムを通じて読み取り可能という状況だけであり、必ずしもVRChat本体が同じマシン上にインストールされている必要はありません。
この解説は、Web技術に詳しくない人やプログラミング初心者が読むことがあるかもしれないということを想定して、冗長な書き方をしています。プログラミングそのものは初心者であったとしても、エラーメッセージなどは自分で検索して、ある程度は自分で原因を特定できるというのが前提です。
調べても納得がいかないとか、いくら検索してもどういうエラーなのかが不明とか、そういう場合は遠慮なくお題箱( https://odaibako.net/u/cleemy_desu_wayo )からメッセージをどうぞ。
まずはブラウザで GitLab Pages 上の https://cleemy-desu-wayo.gitlab.io/ov/webrick_vrchat_instanceinfo.html にアクセスしてみます。
下のほうにある「dummy」ボタンをクリックし、ダミーの情報が表示されるかどうかを確認します。
ダミーのデータを無事に読み込めているのだとしたら、ページの左上の数字は「21」になるはずです。
もしここでダミーのデータが表示されないとしたら、お使いのブラウザでは利用できない可能性があります。あるいは、ブラウザのプラグインやセキュリティ関連のツールなどが介入している可能性もあります。
ちなみにこのダミーのデータの中身については、ユーザー名「cleemy」に関連したもの以外はすべて完全にデタラメなデータになっています。
ダミーのデータは、https://cleemy-desu-wayo.gitlab.io/ov/webrick_vrchat_instanceinfo_dummy.json.txt に置かれた、ただのテキストファイル(静的なデータ)です。
なお、ページの表示直後や「default」ボタンを押した直後などに、「error」と大きく表示されてインスタンスの情報が何も表示されないのは正常な挙動です。localhost に自分でエンドポイントを設置していないにも関わらず、「error」ではなく実際の情報が表示されてしまうのだとしたら、何か異様な事態が進行していることになります。
JSONの配信をするエンドポイントを自分で設置するためには、Rubyのスクリプトが2つ必要です。
まず新規ディレクトリを作成し、そこに移動します。
最新版の outvoke.rb (Outvoke本体)をカレントディレクトリにダウンロードします。
$ wget https://gitlab.com/cleemy-desu-wayo/outvoke/-/raw/main/outvoke.rb
最新版の webrick_vrchat_instanceinfo.rb もカレントディレクトリにダウンロードしておきます。
$ wget https://gitlab.com/cleemy-desu-wayo/outvoke/-/raw/main/samples/2024/webrick_vrchat_instanceinfo.rb
そして outvoke.rb のほうについては、実行権限を付与します。
$ chmod 705 outvoke.rb
そして以下のようにしてOutvoke本体の起動を試します。
$ ./outvoke.rb -e hooksec
以下のような感じで、1秒に1行ずつ出力が増えていくなら、Outvoke本体の起動はできています。
# starting Outvoke 0.1 (version 0.0.99.20241206) ---- 2024-12-09 10:58:32 +0900
# ----
# given ruby code:
# hooksec
# ----
[2024-12-09 10:58:33 +0900] 2024-12-09 10:58:33 +0900
[2024-12-09 10:58:34 +0900] 2024-12-09 10:58:34 +0900
[2024-12-09 10:58:35 +0900] 2024-12-09 10:58:35 +0900
[2024-12-09 10:58:36 +0900] 2024-12-09 10:58:36 +0900
[2024-12-09 10:58:37 +0900] 2024-12-09 10:58:37 +0900
起動可能であることが確認できれば、Ctrl + C で終了しておきます。
起動に失敗する場合は、エラーメッセージに注目して問題を解決してから次のステップに行く必要があります。
最新のバージョンのOutvoke本体には、新しいバグが混入しているという可能性もあります。あえて少し古いバージョンのOutvoke本体を試したいという場合、https://gitlab.com/cleemy-desu-wayo/outvoke/-/commits/main/outvoke.rb からどうぞ。
VRChatを起動し、今度は以下のようにしてOutvokeを起動します。
$ ./outvoke.rb -e 'hook("vrchat-001", /entering room/i)'
エラーが出ていないようなら、Outvokeを起動した状態のままVRChat内で別のワールドに移動してみます。
以下のような感じで、移動するたびに新しいワールドのワールド名が出力されるようなら、VRChatクライアントが出力したログファイルをOutvokeから読むことができているということになります。
# starting Outvoke 0.1 (version 0.0.99.20241206) ---- 2024-12-09 11:02:40 +0900
# ----
# given ruby code:
# hook("vrchat-001", /entering room/i)
# ----
[2024-12-09 11:02:40 +0900] [outvoke-system] vrchat-001: a new log file was found.
[2024-12-09 11:02:40 +0900] [outvoke-system] vrchat-001: first time log check has done.
[2024-12-09 11:04:08 +0900] [Behaviour] Entering Room: Beyond a bit - 想像のちょっと先へ
[2024-12-09 11:05:35 +0900] [Behaviour] Entering Room: Japan Street 0․430
[2024-12-09 11:08:20 +0900] [Behaviour] Entering Room: Moonlit Perch -月明かりの泊まり木-
[2024-12-09 11:08:46 +0900] [Behaviour] Entering Room: Moonlit Perch -月明かりの泊まり木-
[2024-12-09 11:10:48 +0900] [Behaviour] Entering Room: Xen Hall
[2024-12-09 11:13:20 +0900] [Behaviour] Entering Room: Cyber Chill Out Room
読めているのが確認できれば、Outvokeは Ctrl + C で終了しておきます。
エラーが出る場合、エラーメッセージに注目して問題を解決してから次のステップに行く必要があります。
エラーは出ないけれどもワールド名の出力もないという場合、やはり原因を特定してから次のステップに行く必要があります。
以下のように「ERROR: VRChat log file not found」というエラーの出力がある場合、ログファイルがあるディレクトリを明示的に指定する必要があるかもしれません。
[2024-12-09 14:01:21 +0900] [outvoke-system] vrchat-001: ERROR: VRChat log file not found
VRChatのログファイルがあるディレクトリを明示的に指定する方法については、README.ja.md をご覧ください。
ここでの「配信」(delivery)というのは、あくまでも自分が利用するためのJSONのデータを自分のパソコンからのHTTPリクエストに応じて返せる状態にするということです。
まずVRChatを起動し、今度は以下のようにしてOutvokeを起動します。ポート8080は空きであるというのが前提です。
$ ./outvoke.rb webrick_vrchat_instanceinfo.rb
「-e」オプションはワンライナーのモードですが、上記のように起動すると、スクリプトファイルを読み込んで実行しようとします。
起動に失敗する場合、やはりエラーメッセージに注目して問題を解決してから次のステップに行く必要があります。RubyのライブラリであるWEBrickを手動でインストールしたりする必要があるようなケースもあるかもしれません。
起動ができているようなら、HTTP経由でアクセスしてみます。先ほど起動したOutvokeは起動させたままにしておく必要があるため、別のターミナルから以下を実行します。
$ wget http://localhost:8080/outvoke-vrchat-instanceinfo -q -S -O -
以下のように、HTTPレスポンスヘッダーと一緒にJSONデータが標準出力に出力されたなら、ひとまずJSONの配信はできているということになります。
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Vary: Origin
Cache-Control: no-store
Pragma: no-cache
Server: WEBrick/1.7.0 (Ruby/3.0.2/2021-07-07)
Date: Mon, 09 Dec 2024 02:18:04 GMT
Content-Length: 230
Connection: Keep-Alive
{
"world": {
"name": "Cyber Chill Out Room",
"id": "wrld_dc80e8f2-5d48-4bdd-b7f4-3faca6678833",
"instance": "32470",
"region": "jp"
},
"users": {
"usr_eced6a32-b25c-43ae-87aa-ab36c0eee2c5": "cleemy"
}
}
VRChatで別のワールドに移動してから再度 wget をしてみれば分かるように、アクセスするたびに常に最新の情報を返すようになっているはずです。
一般的なブロードバンドルーターの内側にあるパソコンをご使用でれば、意図的にそういう設定をほどこしたことがない限りは、外部から(WAN側から)アクセス可能になっているというわけではありません。あくまでも、ローカルからのリクエストに応答するエンドポイントがあるというだけです。
ちなみに、ポートを8080以外にする場合は、カレントディレクトリに outvoke.conf.rb というファイルを用意し、以下のような行を含めてください。
$webrick_instanceinfo_port = 8081
上記の「$」はターミナルプロンプトの「$」ではなく、Rubyのグローバル変数の「$」であることに注意してください。
wget を通じてJSONが取得できる状態になっているのであれば、ゴールは目前です。
でも GitLab Pages 上に置いた samples/2024/webrick_vrchat_instanceinfo.html ( https://cleemy-desu-wayo.gitlab.io/ov/webrick_vrchat_instanceinfo.html )からJSONが利用できるようにするには、モダンなWebブラウザで異なるドメイン間でのリソースのシェアを可能にするためにCORSの設定をしておく必要があります。
CORS(Cross-Origin Resource Sharing)とは、2014年1月にW3C勧告になった仕様です。
基本的には、ここで示したような形でCORSの設定をするということは、悪意のある人間が不正に情報を読み出そうとするためのパスが一つ増えるのだということは留意しておいてください。
設定のためには、カレントディレクトリに outvoke.conf.rb というファイルを用意します。このファイルがまだ存在しない場合、以下の一行だけの内容にしてください。ファイルがすでに存在している場合、最後に以下の行を追加してください。
$webrick_instanceinfo_cors_list = ["https://cleemy-desu-wayo.gitlab.io"]
CORSについての深い理解がある人のみ、上記以外の値を設定してください。特に「*」を設定する場合は注意が必要です。
上記の「$」はターミナルプロンプトの「$」ではなく、Rubyのグローバル変数の「$」であることに注意してください。
outvoke.conf.rb が作成できたら、もし起動中のOutvokeがあるならそれはいったん終了し、あらためて以下のように起動してみてください。
$ ./outvoke.rb webrick_vrchat_instanceinfo.rb
さっきは起動できたのに outvoke.conf.rb を用意してから起動しなくなったという場合、outvoke.conf.rb のどこかに誤った記述があります。
起動できたら、今度は以下のようにOriginヘッダーを付与してHTTPアクセスしてみてください。
$ wget http://localhost:8080/outvoke-vrchat-instanceinfo -q -S -O - --header="Origin: https://cleemy-desu-wayo.gitlab.io"
OriginヘッダーありのHTTPリクエストによって、レスポンスヘッダーの中に以下のように「Access-Control-Allow-Origin:」で始まる行が追加されるなら、CORSの設定がうまくいっているといえます。
Access-Control-Allow-Origin: https://cleemy-desu-wayo.gitlab.io
レスポンスヘッダーの中に「Access-Control-Allow-Origin:」で始まる行がない場合、原因を特定する必要があります。
CORSの設定がうまくいっているようなら、ブラウザで https://cleemy-desu-wayo.gitlab.io/ov/webrick_vrchat_instanceinfo.html にアクセスしてみます。「F5」でページを更新したり、「default」ボタンを押す必要があるかもしれません。また、ポートが8080でないなら「JSON data URL:」の入力欄に変更を加える必要もあります。
「error」ではなく現在のインスタンスの情報が表示されるようになっていれば成功です。
ちなみに、ここで説明しているCORSの設定方法というのは、samples/2024/webrick_vrchat_instanceinfo.rb における固有のものです。
さてここで、最初の「継続的に使用するメリット」がないという話に戻ります。
ここまで説明してきた手順のとおりなら、そもそもJSONのデータは localhost:8080 で配信しています。だから samples/2024/webrick_vrchat_instanceinfo.html についても、localhost:8080 で利用できるようにすればいいわけです。
つまり、今回作成したディレクトリに最新版の webrick_vrchat_instanceinfo.html も置けばいいのです。
$ wget https://gitlab.com/cleemy-desu-wayo/outvoke/-/raw/main/samples/2024/webrick_vrchat_instanceinfo.html
JSON配信が可能な状態で(先ほどのOutvokeが起動された状態のままで)ブラウザで http://localhost:8080/webrick_vrchat_instanceinfo.html にアクセスすれば、localhost版の webrick_vrchat_instanceinfo.html が利用可能になるはずです。
この場合は、CORSの設定をする必要もありません。JSONを読み取る側も、JSONを配信する側も、ともに localhost:8080 だからです。先ほどの outvoke.conf.rb は削除してしまったほうが安全です。
一般論として、SPAとしての性質を持つアプリケーションは、頻繁に更新されているならば GitLab Pages などに置いておくことにはメリットがあります。そこにアクセスさえできれば、常に最新版が利用できるからです。でも samples/2024/webrick_vrchat_instanceinfo.html はただのサンプルプログラムであり、頻繁に更新されることはありません。
とりあえず解説は以上です。
疑問点などはお題箱( https://odaibako.net/u/cleemy_desu_wayo )へどうぞ。