「Webブラウザ(Chrome)」の版間の差分
Notion-MW タグ: 差し戻し済み |
Notion-MW |
||
(同じ利用者による、間の2版が非表示) | |||
19行目: | 19行目: | ||
こうして生成されたショートカットを見ると、(例えばWindowsなら)<code>"C:\Program Files\Google\Chrome\Application\chrome_proxy.exe" --profile-directory=Default --app-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</code>のようなコマンドラインが設定されているのがわかるだろう。調べた結果、この<code>--app-id</code>というのは、以下のようなプロセスで生成されるようである。 | こうして生成されたショートカットを見ると、(例えばWindowsなら)<code>"C:\Program Files\Google\Chrome\Application\chrome_proxy.exe" --profile-directory=Default --app-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</code>のようなコマンドラインが設定されているのがわかるだろう。調べた結果、この<code>--app-id</code>というのは、以下のようなプロセスで生成されるようである。 | ||
# アプリのURLを決定する。この際、manifestが指定されていれば、そこにある<code>start_url</code>が使われるようである(たとえばTwitterのを見ると、<code>"start_url":"https://twitter.com/?utm_source=homescreen&utm_medium=shortcut"</code>と書いてある)。また、トップページのときは末尾に<code>/</code>を付ける?(例: <code>https://chat.openai.com/</code>)これらに該当しない場合は普通にそのページのURLがそのまま使われる。 | |||
# URLにSHA-256ハッシュを2度適用し、その前半部分(16進数で32桁)をa-pの16文字で表現する。 | |||
この2.の部分は[https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/web_applications/web_app_helpers_unittest.cc ソースコード]に書いてある[https://play.golang.org/p/VrIq_QKFjiV playground]で試すこともできる。pythonで書くと以下のようになる(URLはコマンドライン引数として渡すことを想定)。 | この2.の部分は[https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/web_applications/web_app_helpers_unittest.cc ソースコード]に書いてある[https://play.golang.org/p/VrIq_QKFjiV playground]で試すこともできる。pythonで書くと以下のようになる(URLはコマンドライン引数として渡すことを想定)。 | ||
<syntaxhighlight lang="import hashlib | <syntaxhighlight lang="python">import hashlib | ||
m = hashlib.sha256() | m = hashlib.sha256() | ||
m.update(bytes("https://chat.openai.com/".encode('ascii'))) | m.update(bytes("https://chat.openai.com/".encode('ascii'))) |