| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474 |
- <!doctype html>
- <!-- Generated by scripts/sitegen. Edit the files there and run `go run .`; changes made here are overwritten. -->
- <html lang="ja" data-theme="light" class="accent-makers">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
- <title>サブサービス(非推奨)— ArozOS</title>
- <meta name="description" content="ArozOS サブサービスの仕組み。どの言語で書いたバイナリでも、ArozOS が起動・プロキシしてデスクトップに載せます。サブサービスの基盤は非推奨で、今後メンテナンスされません。">
- <link rel="canonical" href="https://os.aroz.org/ja/subservice/">
- <link rel="alternate" hreflang="en" href="https://os.aroz.org/subservice/" data-href="../../subservice/">
- <link rel="alternate" hreflang="zh-Hant" href="https://os.aroz.org/zh-tw/subservice/" data-href="../../zh-tw/subservice/">
- <link rel="alternate" hreflang="zh-Hans" href="https://os.aroz.org/zh-cn/subservice/" data-href="../../zh-cn/subservice/">
- <link rel="alternate" hreflang="ja" href="https://os.aroz.org/ja/subservice/" data-href="./">
- <link rel="alternate" hreflang="x-default" href="https://os.aroz.org/subservice/">
- <script>
-
- (function () {
- var d = document.documentElement, s = null, l = null;
- d.className += " js";
- try { s = localStorage.getItem("aroz-theme"); l = localStorage.getItem("aroz-lang"); } catch (e) {}
- var p = s === "light" || s === "dark" ? s : "auto";
- d.setAttribute("data-theme-pref", p);
- d.setAttribute("data-theme", p === "auto" ? (matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light") : p);
- if (l || d.lang !== "en" || /bot|crawl|spider/i.test(navigator.userAgent)) return;
- var want = "", list = navigator.languages || [navigator.language || ""];
- for (var i = 0; i < list.length && !want; i++) {
- var c = (list[i] || "").toLowerCase();
- if (c.indexOf("zh") === 0) want = /hant|tw|hk|mo/.test(c) ? "zh-Hant" : "zh-Hans";
- else if (c.indexOf("ja") === 0) want = "ja";
- else if (c.indexOf("en") === 0) want = "en";
- }
- try { localStorage.setItem("aroz-lang", want || "en"); } catch (e) { return; }
- if (!want || want === "en") return;
- var alt = document.querySelector('link[rel="alternate"][hreflang="' + want + '"]');
- if (alt) location.replace(alt.getAttribute("data-href") + location.hash);
- })();
- </script>
- <meta name="color-scheme" content="light dark">
- <meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)">
- <meta name="theme-color" content="#000000" media="(prefers-color-scheme: dark)">
- <meta property="og:type" content="website">
- <meta property="og:site_name" content="ArozOS">
- <meta property="og:title" content="サブサービス(非推奨)— ArozOS">
- <meta property="og:description" content="ArozOS サブサービスの仕組み。どの言語で書いたバイナリでも、ArozOS が起動・プロキシしてデスクトップに載せます。サブサービスの基盤は非推奨で、今後メンテナンスされません。">
- <meta property="og:url" content="https://os.aroz.org/ja/subservice/">
- <meta property="og:image" content="https://os.aroz.org/img/og.png">
- <meta property="og:locale" content="ja_JP">
- <meta name="twitter:card" content="summary_large_image">
- <link rel="icon" href="../../img/favicon.png">
- <link rel="apple-touch-icon" href="../../img/apple-touch-icon.png">
- <link rel="stylesheet" href="../../assets/site.css?v=0b27a21e">
- <script src="../../assets/site.js?v=0b27a21e" defer></script>
- </head>
- <body>
- <a class="skip" href="#main">本文へスキップ</a>
- <header class="nav" id="nav">
- <div class="nav-in">
- <a class="brand" href="../" aria-label="ArozOS"><svg class="logo" viewBox="0 0 256 256" aria-hidden="true"><rect class="logo-bg" width="256" height="256" rx="58"/><path class="logo-fg" d="M70 58h116l-58 70zM128 128l58 70H70z"/></svg><span>ArozOS</span></a>
- <nav class="nav-links" aria-label="メインメニュー">
- <a href="../desktop.html">デスクトップ</a>
- <a href="../media.html">メディア</a>
- <a href="../office.html">オフィス</a>
- <a href="../ai.html">AI</a>
- <a href="../makers.html">メイカー</a>
- <a href="../storage.html">ストレージ</a>
- <a href="../server.html">サーバー</a>
-
- </nav>
- <div class="nav-tools">
- <div class="pop" data-pop>
- <button type="button" class="icon-btn" aria-haspopup="menu" aria-expanded="false" aria-label="言語" title="言語"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c2.5 2.7 3.8 5.7 3.8 9s-1.3 6.3-3.8 9c-2.5-2.7-3.8-5.7-3.8-9S9.5 5.7 12 3z"/></svg></button>
- <div class="pop-menu" role="menu"><a role="menuitemradio" href="../../subservice/" hreflang="en" lang="en" data-lang="en" aria-checked="false">English</a><a role="menuitemradio" href="../../zh-tw/subservice/" hreflang="zh-Hant" lang="zh-Hant" data-lang="zh-Hant" aria-checked="false">繁體中文</a><a role="menuitemradio" href="../../zh-cn/subservice/" hreflang="zh-Hans" lang="zh-Hans" data-lang="zh-Hans" aria-checked="false">简体中文</a><a role="menuitemradio" href="./" hreflang="ja" lang="ja" data-lang="ja" aria-checked="true">日本語</a></div>
- </div>
- <div class="pop" data-pop>
- <button type="button" class="icon-btn theme-btn" aria-haspopup="menu" aria-expanded="false" aria-label="外観" title="外観"><span class="ti-light"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="4"/><path d="M12 2.5v2M12 19.5v2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M2.5 12h2M19.5 12h2M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"/></svg></span><span class="ti-dark"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M20.5 14.5A8.5 8.5 0 0 1 9.5 3.5a8.5 8.5 0 1 0 11 11z"/></svg></span><span class="ti-auto"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="8.5"/><path d="M12 3.5a8.5 8.5 0 0 1 0 17z" fill="currentColor"/></svg></span></button>
- <div class="pop-menu" role="menu"><button type="button" role="menuitemradio" data-theme-set="light" aria-checked="false"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="4"/><path d="M12 2.5v2M12 19.5v2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M2.5 12h2M19.5 12h2M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"/></svg><span>ライト</span></button><button type="button" role="menuitemradio" data-theme-set="dark" aria-checked="false"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M20.5 14.5A8.5 8.5 0 0 1 9.5 3.5a8.5 8.5 0 1 0 11 11z"/></svg><span>ダーク</span></button><button type="button" role="menuitemradio" data-theme-set="auto" aria-checked="false"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="8.5"/><path d="M12 3.5a8.5 8.5 0 0 1 0 17z" fill="currentColor"/></svg><span>自動</span></button></div>
- </div>
- <a class="btn primary sm nav-dl" href="../download.html">ダウンロード</a>
- <button type="button" class="icon-btn menu-btn" aria-expanded="false" aria-controls="sheet" aria-label="メニュー"><span class="mi-open"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 9h16M4 15h16"/></svg></span><span class="mi-close"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M6 6l12 12M18 6L6 18"/></svg></span></button>
- </div>
- </div>
- <div class="sheet" id="sheet">
- <nav class="sheet-links" aria-label="メインメニュー">
- <a href="../">概要</a>
- <a href="../desktop.html">デスクトップ</a>
- <a href="../media.html">メディア</a>
- <a href="../office.html">オフィス</a>
- <a href="../ai.html">AI</a>
- <a href="../makers.html">メイカー</a>
- <a href="../storage.html">ストレージ</a>
- <a href="../server.html">サーバー</a>
- <a href="../download.html">ダウンロード</a>
- </nav>
- <div class="sheet-ctl">
- <p class="ctl-label">言語</p>
- <div class="seg lang-seg" role="menu"><a role="menuitemradio" href="../../subservice/" hreflang="en" lang="en" data-lang="en" aria-checked="false">English</a><a role="menuitemradio" href="../../zh-tw/subservice/" hreflang="zh-Hant" lang="zh-Hant" data-lang="zh-Hant" aria-checked="false">繁體中文</a><a role="menuitemradio" href="../../zh-cn/subservice/" hreflang="zh-Hans" lang="zh-Hans" data-lang="zh-Hans" aria-checked="false">简体中文</a><a role="menuitemradio" href="./" hreflang="ja" lang="ja" data-lang="ja" aria-checked="true">日本語</a></div>
- <p class="ctl-label">外観</p>
- <div class="seg" role="menu"><button type="button" role="menuitemradio" data-theme-set="light" aria-checked="false"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="4"/><path d="M12 2.5v2M12 19.5v2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M2.5 12h2M19.5 12h2M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"/></svg><span>ライト</span></button><button type="button" role="menuitemradio" data-theme-set="dark" aria-checked="false"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M20.5 14.5A8.5 8.5 0 0 1 9.5 3.5a8.5 8.5 0 1 0 11 11z"/></svg><span>ダーク</span></button><button type="button" role="menuitemradio" data-theme-set="auto" aria-checked="false"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="8.5"/><path d="M12 3.5a8.5 8.5 0 0 1 0 17z" fill="currentColor"/></svg><span>自動</span></button></div>
- </div>
- </div>
- </header>
- <main id="main">
- <section class="hero">
- <div class="wrap hero-head">
- <p class="eyebrow rv">開発者ドキュメント</p>
- <h1 class="hero-title rv" style="--d:1"><span class="grad">サブサービス</span></h1>
- <p class="hero-sub rv" style="--d:2">どの言語で書いたバイナリでも、ArozOS が起動し、同じログインのままプロキシして、デスクトップに載せます。</p>
-
- </div>
-
- </section>
- <section class="notice-sec">
- <div class="wrap narrow">
- <div class="notice rv" role="note">
- <div class="notice-ic"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M10.3 4.2L2.8 17.5A2 2 0 0 0 4.5 20.5h15a2 2 0 0 0 1.7-3L13.7 4.2a2 2 0 0 0-3.4 0z"/><path d="M12 9.5v4.2"/><path d="M12 17h.01"/></svg></div>
- <div class="notice-body">
- <p class="notice-tag">非推奨</p>
- <h2>サブサービスの基盤は今後メンテナンスされません</h2>
- <p>サブサービスはこのページの説明どおり引き続き動作しますが、新機能や修正は提供されず、将来のリリースで削除される可能性があります。新しいプロジェクトでは使わないでください。このページは、すでに使っている方のために残してあります。新しく作る場合は、次の方法を使ってください。</p>
- <ul><li><strong>WebApp</strong>:フォルダに置いた HTML と JavaScript。ファイルやデータベースなどには、サーバーサイドの AGI スクリプトでアクセスします。</li><li><strong>Container App</strong>:Docker など、どこで動いている Web サーバーでも、ArozOS のポート経由で公開してデスクトップにピン留めできます。</li></ul>
- <div class="btns"><a class="btn primary" href="../makers.html"><span>WebApp と AGI</span></a><a class="btn secondary" href="../server.html"><span>Container Apps</span></a></div>
- </div>
- </div>
- </div>
- </section>
- <section class="doc-sec" id="overview">
- <div class="wrap narrow">
- <div class="doc-head rv">
- <p class="eyebrow">概要</p>
- <h2 class="doc-title">ArozOS が代わりに動かすプログラム</h2>
-
- </div>
- <div class="doc-item rv">
-
- <div class="doc-text">サブサービスは独立したプログラム(多くは小さな Web サーバー)で、ArozOS が子プロセスとして起動し、自身のアドレスの下でリバースプロキシします。コアの外で動くため、Go、Rust、Python など HTTP を話せる言語なら何でも使え、サンドボックス化された AGI の JavaScript では扱えないネイティブコードも使えます。</div>
-
-
-
-
- </div>
- <div class="doc-item rv">
-
- <div class="doc-text">読み込まれると通常のモジュールとして登録され、デスクトップとスタートメニューに表示されます。内蔵の WebApp と同じく、ユーザーごとに権限が必要です。</div>
-
-
- <p class="note"><strong>豆知識:</strong>サブサービスのために作られた認証付きリバースプロキシが、のちに独立したリバースプロキシ <a href="https://zoraxy.aroz.org">Zoraxy</a> へと育ちました。</p>
-
- </div>
-
- </div>
- </section>
- <section class="doc-sec" id="layout">
- <div class="wrap narrow">
- <div class="doc-head rv">
-
- <h2 class="doc-title">フォルダ構成</h2>
- <p class="lead">サブサービスはそれぞれ、ArozOS の実行ファイルの隣にある <code>subservice/</code> の下に専用のフォルダを持ちます。実行ファイルはフォルダ名にプラットフォーム名を付けた名前にします。</p>
- </div>
- <div class="doc-item rv">
-
-
-
- <div class="cmd"><pre><code>subservice/
- demo/
- demo.exe Windows
- demo_linux_amd64 Linux, x86-64
- demo_linux_arm64 Linux, ARM64
- demo_darwin_amd64 macOS, Intel
- moduleInfo.json optional, see "Describing the module"
- web/ anything the service serves</code></pre><button type="button" class="copy" data-copy aria-label="コピー" title="コピー"><span class="c-copy"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="11" height="11" rx="2.5"/><path d="M5.5 15H5a1.5 1.5 0 0 1-1.5-1.5V5A1.5 1.5 0 0 1 5 3.5h8.5A1.5 1.5 0 0 1 15 5v.5"/></svg></span><span class="c-done"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></button></div>
- <p class="note">Windows では <code><フォルダ名>.exe</code>、それ以外では <code><フォルダ名>_<GOOS>_<GOARCH></code> です。ArozOS はサービスのフォルダ内でプロセスを起動するため、<code>./web</code> のような相対パスがそのまま使えます。</p>
-
- </div>
-
- </div>
- </section>
- <section class="doc-sec" id="startup">
- <div class="wrap narrow">
- <div class="doc-head rv">
-
- <h2 class="doc-title">起動時の流れ</h2>
-
- </div>
- <div class="doc-item rv">
-
-
- <ul class="doc-list"><li>ArozOS が現在のプラットフォーム用の実行ファイルを探します。無い場合、そのサービスは読み飛ばされます。</li><li>モジュール情報を <code>moduleInfo.json</code> から読み込みます。無い場合は <code><実行ファイル> -info</code> を実行し、下記の JSON オブジェクトを出力して終了する必要があります。</li><li>次の 2 つのフラグを付けてもう一度起動し、常駐サーバーとして動かして、プロキシを開始します。</li></ul>
-
-
-
- </div>
- <div class="doc-item rv">
-
- <div class="doc-text"><code>-port</code> は <code>12810</code> から数えて最初に空いているポートです。<code>-rpt</code> はこの ArozOS の AGI ゲートウェイで、サブサービスが ArozOS を呼び返すときのアドレスです(後述)。</div>
-
- <div class="cmd"><pre><code>demo_linux_amd64 -port :12810 -rpt http://localhost:8080/api/ajgi/interface</code></pre><button type="button" class="copy" data-copy aria-label="コピー" title="コピー"><span class="c-copy"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="11" height="11" rx="2.5"/><path d="M5.5 15H5a1.5 1.5 0 0 1-1.5-1.5V5A1.5 1.5 0 0 1 5 3.5h8.5A1.5 1.5 0 0 1 15 5v.5"/></svg></span><span class="c-done"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></button></div>
- <p class="note">起動時にモジュール情報を読み取れないサブサービスや、予約済みのパスを要求するサブサービスがあると、ArozOS が起動しません。管理者があとから手動で起動した場合は、同じ問題でもエラーが表示されるだけです。</p>
-
- </div>
-
- </div>
- </section>
- <section class="doc-sec" id="module-info">
- <div class="wrap narrow">
- <div class="doc-head rv">
-
- <h2 class="doc-title">モジュールの記述</h2>
- <p class="lead">モジュール情報は 1 つの JSON オブジェクトです。すべての WebApp が登録に使うのと同じ <code>ModuleInfo</code> なので、サブサービスもほかのアプリと同じようにデスクトップに表示されます。</p>
- </div>
- <div class="doc-item rv">
-
-
-
- <div class="cmd"><pre><code>{
- "Name": "Demo Subservice",
- "Desc": "A simple subservice showing how subservices work in ArozOS",
- "Group": "Development",
- "IconPath": "demo/icon.png",
- "Version": "0.0.1",
- "StartDir": "demo/home.html",
- "SupportFW": true,
- "LaunchFWDir": "demo/home.html",
- "SupportEmb": true,
- "LaunchEmb": "demo/embedded.html",
- "InitFWSize": [720, 480],
- "InitEmbSize": [720, 480],
- "SupportedExt": [".txt", ".md"]
- }</code></pre><button type="button" class="copy" data-copy aria-label="コピー" title="コピー"><span class="c-copy"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="11" height="11" rx="2.5"/><path d="M5.5 15H5a1.5 1.5 0 0 1-1.5-1.5V5A1.5 1.5 0 0 1 5 3.5h8.5A1.5 1.5 0 0 1 15 5v.5"/></svg></span><span class="c-done"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></button></div>
- <p class="note"><code>StartDir</code> のフォルダ部分(ここでは <code>demo</code>)がプロキシのエンドポイントになります。空にはできず、予約済みの <code>web</code>、<code>system</code>、<code>SystemAO</code>、<code>img</code>、<code>STDIN</code>、<code>STDOUT</code>、<code>STDERR</code>、<code>COM</code>、<code>ws</code>、<code>cluster</code>、<code>app</code> も使えません。</p>
-
- </div>
-
- </div>
- </section>
- <section class="specs-sec tone-alt">
- <div class="wrap narrow">
- <div class="sec-head rv">
-
- <h2 class="title">モジュールのフィールド</h2>
-
- </div>
- <dl class="specs"><div class="spec rv">
- <dt>Name</dt>
- <dd><p>デスクトップに表示される名前です。権限はこの名前で付与されるため、重複しないようにしてください。</p></dd>
- </div><div class="spec rv">
- <dt>Desc</dt>
- <dd><p>短い説明文です。</p></dd>
- </div><div class="spec rv">
- <dt>Group</dt>
- <dd><p>スタートメニューの分類:<code>Media</code>、<code>Office</code>、<code>Internet</code>、<code>Engineering</code>、<code>Development</code>、<code>System Tools</code>、<code>Utilities</code>。それ以外は「その他」に入ります。<code>Utilities</code> と <code>System Tools</code> は全ユーザーに開放され、ほかの分類は権限グループへの付与が必要です。</p></dd>
- </div><div class="spec rv">
- <dt>IconPath</dt>
- <dd><p>アイコン。サービスが配信するパスで指定します(例:<code>demo/icon.png</code>)。</p></dd>
- </div><div class="spec rv">
- <dt>Version</dt>
- <dd><p><code>0.0.1</code> のようなバージョン文字列です。</p></dd>
- </div><div class="spec rv">
- <dt>StartDir</dt>
- <dd><p>フルページで開くページです。そのフォルダがプロキシのエンドポイントになります。</p></dd>
- </div><div class="spec rv">
- <dt>SupportFW, LaunchFWDir, InitFWSize</dt>
- <dd><p>フローティングウィンドウで開く設定です。対応するかどうか、読み込むページ、開始サイズ <code>[幅, 高さ]</code> を指定します。</p></dd>
- </div><div class="spec rv">
- <dt>SupportEmb, LaunchEmb, InitEmbSize</dt>
- <dd><p>埋め込みモードです。このモジュールでファイルを開くときに読み込まれます。設定項目は同じ 3 つです。</p></dd>
- </div><div class="spec rv">
- <dt>SupportedExt</dt>
- <dd><p>モジュールが開ける拡張子です(例:<code>[".txt", ".md"]</code>)。既定のアプリとして設定できるようになります。</p></dd>
- </div></dl>
-
- </div>
- </section>
- <section class="doc-sec" id="proxy">
- <div class="wrap narrow">
- <div class="doc-head rv">
-
- <h2 class="doc-title">リクエストがサービスに届くまで</h2>
-
- </div>
- <div class="doc-item rv">
-
-
- <ul class="doc-list"><li>ログイン済みで、そのモジュールの権限を持つユーザーだけが通れます。それ以外は 404 になります。</li><li>エンドポイントのフォルダはパスから取り除かれます。<code>/demo/api/list?a=1</code> はサービスには <code>/api/list?a=1</code>、<code>/demo/</code> は <code>/</code> として届きます。そのためページ内のリンクは相対パスか、エンドポイントのフォルダで始まるパスにしてください。<code>/api/list</code> へのリンクは ArozOS 自身に届いてしまいます。</li><li>ArozOS は 3 つのリクエストヘッダーを付けます。<code>aouser</code>(ユーザー名)、<code>aotoken</code>(そのユーザーのトークン)、<code>X-Forwarded-Host</code>(ブラウザが使ったホスト)です。</li><li>WebSocket 接続もプロキシされます。その場合は <code>A-Upgrade: websocket</code> も付きます。</li><li>サービスが応答しなくなると、ArozOS はログに記録してプロセスを終了し、10 秒後に再起動します。</li></ul>
-
- <p class="note">これらのヘッダーの信頼性はポート次第です。すべてのインターフェースで待ち受けると、そのポートに届く人なら誰でも <code>aouser</code> を自分で送れてしまいます。<code>127.0.0.1</code> にバインドするか、<code>12810</code> 以降のポートを外部から遮断してください。</p>
-
- </div>
-
- </div>
- </section>
- <section class="doc-sec" id="agi">
- <div class="wrap narrow">
- <div class="doc-head rv">
-
- <h2 class="doc-title">ArozOS を呼び返す</h2>
- <p class="lead">サブサービスは、<code>-rpt</code> で受け取った AGI ゲートウェイ経由で ArozOS の機能を使います。ユーザーのトークンとスクリプトを POST すると、スクリプトはそのユーザーの権限で AGI ランタイム内で実行され、<code>sendJSONResp</code> で送った内容がレスポンスになります。</p>
- </div>
- <div class="doc-item rv">
-
-
-
- <div class="cmd"><pre><code>func listDesktop(w http.ResponseWriter, r *http.Request) {
- token := r.Header.Get("aotoken")
- script := `
- requirelib("filelib");
- var list = filelib.glob("user:/Desktop/*");
- sendJSONResp(JSON.stringify(list));
- `
- // rpt is the value of the -rpt flag
- resp, err := http.PostForm(rpt, url.Values{
- "token": {token},
- "script": {script},
- })
- if err != nil {
- http.Error(w, err.Error(), http.StatusBadGateway)
- return
- }
- defer resp.Body.Close()
- w.Header().Set("Content-Type", "application/json")
- io.Copy(w, resp.Body)
- }</code></pre><button type="button" class="copy" data-copy aria-label="コピー" title="コピー"><span class="c-copy"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="11" height="11" rx="2.5"/><path d="M5.5 15H5a1.5 1.5 0 0 1-1.5-1.5V5A1.5 1.5 0 0 1 5 3.5h8.5A1.5 1.5 0 0 1 15 5v.5"/></svg></span><span class="c-done"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></button></div>
- <p class="note">フォームのフィールドは <code>token</code>(リクエストの <code>aotoken</code> ヘッダー)と <code>script</code> です。ステータスコードだけではスクリプトが成功したか分からないので、返ってきた内容を確認してください。</p>
-
- </div>
-
- </div>
- </section>
- <section class="doc-sec" id="example">
- <div class="wrap narrow">
- <div class="doc-head rv">
-
- <h2 class="doc-title">最小のサービス</h2>
- <p class="lead">この Go プログラムは <code>-info</code> に応答し、<code>web/</code> フォルダを配信し、ログイン中のユーザーに挨拶する API を 1 つ持っています。</p>
- </div>
- <div class="doc-item rv">
-
- <div class="doc-text">Web ページ、AGI 呼び出し、アイコン、各プラットフォーム向けのビルドスクリプトを含む完全なサンプルは、サンプルリポジトリにあります。</div>
-
- <div class="cmd"><pre><code>package main
- import (
- "encoding/json"
- "flag"
- "fmt"
- "log"
- "net/http"
- )
- func main() {
- info := flag.Bool("info", false, "print the module information and exit")
- port := flag.String("port", ":8000", "listen address chosen by ArozOS")
- flag.String("rpt", "", "AGI gateway of ArozOS")
- flag.Parse()
- if *info {
- b, _ := json.Marshal(map[string]any{
- "Name": "Demo Subservice",
- "Desc": "A simple subservice",
- "Group": "Development",
- "IconPath": "demo/icon.png",
- "Version": "0.0.1",
- "StartDir": "demo/home.html",
- "SupportFW": true,
- "LaunchFWDir": "demo/home.html",
- "InitFWSize": []int{720, 480},
- })
- fmt.Println(string(b))
- return
- }
- http.HandleFunc("/whoami", func(w http.ResponseWriter, r *http.Request) {
- fmt.Fprintln(w, "Hello", r.Header.Get("aouser"))
- })
- http.Handle("/", http.FileServer(http.Dir("./web")))
- log.Println("demo listening on", *port)
- log.Fatal(http.ListenAndServe(*port, nil))
- }</code></pre><button type="button" class="copy" data-copy aria-label="コピー" title="コピー"><span class="c-copy"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="11" height="11" rx="2.5"/><path d="M5.5 15H5a1.5 1.5 0 0 1-1.5-1.5V5A1.5 1.5 0 0 1 5 3.5h8.5A1.5 1.5 0 0 1 15 5v.5"/></svg></span><span class="c-done"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></button></div>
-
- <div class="btns"><a class="btn secondary" href="https://github.com/aroz-online/ArozOS-Subservice-Example" target="_blank" rel="noopener"><svg class="i" viewBox="0 0 16 16" aria-hidden="true" fill="currentColor"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg><span>サブサービスのサンプル</span></a></div>
- </div>
-
- </div>
- </section>
- <section class="specs-sec tone-alt" id="marker-files">
- <div class="wrap narrow">
- <div class="sec-head rv">
-
- <h2 class="title">マーカーファイル</h2>
- <p class="lead">サービスのフォルダに置く空のファイルで、起動方法を変えられます。サービスの起動のたびに読み込まれます。</p>
- </div>
- <dl class="specs"><div class="spec rv">
- <dt>.disabled</dt>
- <dd><p>起動時にこのサービスを読み飛ばします。管理者がサービスを停止すると ArozOS が自分で作成し、再び起動すると削除します。</p></dd>
- </div><div class="spec rv">
- <dt>.noproxy</dt>
- <dd><p>互換モードです。引数なしでプログラムを起動し、プロキシは設定しません。ArozOS 向けに作られていないソフトウェア用です。</p></dd>
- </div><div class="spec rv">
- <dt>.startscript</dt>
- <dd><p>バイナリの代わりに、サービスのフォルダにある <code>start.sh</code>(Windows では <code>start.bat</code>)を起動します。追加の引数が必要なプログラムを包むときなどに使います。スクリプトにも、バイナリと同じく <code>-port</code> と <code>-rpt</code> が渡されます。</p></dd>
- </div><div class="spec rv">
- <dt>.intport</dt>
- <dd><p>ポートを <code>:12810</code> ではなく <code>12810</code> として渡します。先頭のコロンを受け付けないプログラム用です。</p></dd>
- </div><div class="spec rv">
- <dt>moduleInfo.json</dt>
- <dd><p>ファイルで用意したモジュール情報です。存在する場合、ArozOS はバイナリを <code>-info</code> 付きで実行しません。</p></dd>
- </div></dl>
-
- </div>
- </section>
- <section class="doc-sec" id="runtime">
- <div class="wrap narrow">
- <div class="doc-head rv">
-
- <h2 class="doc-title">サービスの管理</h2>
- <p class="lead">管理者はシステム設定からサービスを起動・停止できます。その画面は次のエンドポイントを使っています。</p>
- </div>
- <div class="doc-item rv">
-
-
- <ul class="doc-list"><li><code>/system/subservice/list</code> は、動作中と無効化されたサービスを一覧します。</li><li><code>/system/subservice/kill</code> はサービスを停止します。管理者のみで、フォームのフィールド <code>serviceDir</code> にフォルダ名を指定します。</li><li><code>/system/subservice/start</code> はサービスを起動します。管理者のみで、フィールドは同じです。</li></ul>
-
- <p class="note">ArozOS を <code>-disable_subservice</code> 付きで起動すると、この機能全体を無効にできます。</p>
-
- </div>
-
- </div>
- </section>
- <section class="cta">
- <div class="wrap narrow rv">
- <div class="cta-logo"><svg class="logo" viewBox="0 0 256 256" aria-hidden="true"><rect class="logo-bg" width="256" height="256" rx="58"/><path class="logo-fg" d="M70 58h116l-58 70zM128 128l58 70H70z"/></svg></div>
- <h2 class="title">すでにサブサービスを使っていますか?</h2>
- <p class="lead">サンプルリポジトリは、サブサービスの作り方を知る最良の資料です。ただし、この基盤はもうメンテナンスされていないことにご注意ください。</p>
- <div class="btns center"><a class="btn primary" href="https://github.com/aroz-online/ArozOS-Subservice-Example" target="_blank" rel="noopener"><svg class="i" viewBox="0 0 16 16" aria-hidden="true" fill="currentColor"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg><span>サブサービスのサンプル</span></a><a class="btn secondary" href="../makers.html"><span>代わりに WebApp を作る</span></a></div>
- </div>
- </section>
- </main>
- <footer class="foot">
- <div class="wrap">
- <div class="foot-top">
- <div class="foot-brand">
- <a class="brand" href="../" aria-label="ArozOS"><svg class="logo" viewBox="0 0 256 256" aria-hidden="true"><rect class="logo-bg" width="256" height="256" rx="58"/><path class="logo-fg" d="M70 58h116l-58 70zM128 128l58 70H70z"/></svg><span>ArozOS</span></a>
- <p>自分のサーバーのための Web デスクトップ。</p>
- </div>
- <div class="foot-col">
- <h2>見る</h2>
- <ul><li><a href="../desktop.html">デスクトップ</a></li><li><a href="../media.html">メディア</a></li><li><a href="../office.html">オフィス</a></li><li><a href="../ai.html">AI</a></li><li><a href="../makers.html">メイカー</a></li><li><a href="../storage.html">ストレージ</a></li><li><a href="../server.html">サーバー</a></li><li><a href="../download.html">ダウンロード</a></li></ul>
- </div>
- <div class="foot-col">
- <h2>開発者</h2>
- <ul><li><a href="https://aroz-online.github.io/ArozOS-Developers/" target="_blank" rel="noopener">AGI ドキュメント</a></li><li><a href="https://github.com/aroz-online/WebApp-and-Subservice-Index" target="_blank" rel="noopener">WebApp とサブサービス</a></li><li><a href="./">サブサービス(非推奨)</a></li><li><a href="https://github.com/aroz-online/ArozOS-Subservice-Example" target="_blank" rel="noopener">サブサービスのサンプル</a></li><li><a href="../../ArozOS-Cluster-Whitepaper.pdf">クラスター ホワイトペーパー</a></li><li><a href="https://github.com/aroz-online/launcher" target="_blank" rel="noopener">ArozOS Launcher</a></li></ul>
- </div>
- <div class="foot-col">
- <h2>コミュニティ</h2>
- <ul><li><a href="https://github.com/tobychui/arozos" target="_blank" rel="noopener">ソースコード</a></li><li><a href="https://github.com/tobychui/arozos/releases" target="_blank" rel="noopener">リリース</a></li><li><a href="https://github.com/tobychui/arozos/issues" target="_blank" rel="noopener">問題を報告</a></li><li><a href="https://t.me/ArOZBeta" target="_blank" rel="noopener">Telegram</a></li><li><a href="mailto:toby@imuslab.com">メール</a></li></ul>
- </div>
- <div class="foot-col">
- <h2>関連プロジェクト</h2>
- <ul><li><a href="https://zoraxy.aroz.org" target="_blank" rel="noopener">Zoraxy</a></li><li><a href="https://github.com/tobychui/imusutm" target="_blank" rel="noopener">imusutm</a></li><li><a href="https://github.com/tobychui/SlicerA" target="_blank" rel="noopener">Slicer A</a></li><li><a href="https://github.com/SysAdmin74/ArozOS-Docker" target="_blank" rel="noopener">ArozOS Docker(コミュニティ)</a></li><li><a href="https://imuslab.com" target="_blank" rel="noopener">imuslab</a></li></ul>
- </div>
-
- </div>
- <div class="foot-bottom">
- <p>Copyright © 2016–<span data-year>2026</span> Toby Chui feat. imuslab. 香港発。 <a href="https://github.com/tobychui/arozos/blob/master/LICENSE">GPLv3</a> のオープンソースです。</p>
- <div class="foot-ctl">
- <div class="seg sm" role="menu" aria-label="外観"><button type="button" role="menuitemradio" data-theme-set="light" aria-checked="false"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="4"/><path d="M12 2.5v2M12 19.5v2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M2.5 12h2M19.5 12h2M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"/></svg><span>ライト</span></button><button type="button" role="menuitemradio" data-theme-set="dark" aria-checked="false"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M20.5 14.5A8.5 8.5 0 0 1 9.5 3.5a8.5 8.5 0 1 0 11 11z"/></svg><span>ダーク</span></button><button type="button" role="menuitemradio" data-theme-set="auto" aria-checked="false"><svg class="i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="8.5"/><path d="M12 3.5a8.5 8.5 0 0 1 0 17z" fill="currentColor"/></svg><span>自動</span></button></div>
- <div class="foot-langs" role="menu" aria-label="言語"><a role="menuitemradio" href="../../subservice/" hreflang="en" lang="en" data-lang="en" aria-checked="false">English</a><a role="menuitemradio" href="../../zh-tw/subservice/" hreflang="zh-Hant" lang="zh-Hant" data-lang="zh-Hant" aria-checked="false">繁體中文</a><a role="menuitemradio" href="../../zh-cn/subservice/" hreflang="zh-Hans" lang="zh-Hans" data-lang="zh-Hans" aria-checked="false">简体中文</a><a role="menuitemradio" href="./" hreflang="ja" lang="ja" data-lang="ja" aria-checked="true">日本語</a></div>
- </div>
- </div>
- </div>
- </footer>
- </body>
- </html>
|