- プログラミング言語「なでしこv3」のプログラムとリソースを保存するためのストレージ。
- なでしこ3のプログラムやリソースの保存・読込を手軽に行うためのWebサービス。
- なでしこのサイトで運用しているものの、自分のサイトで運用したい場合も手軽に利用できる。
- [基本URL] https://n3s.nadesi.com/
- ReleaseからZIPファイルをダウンロードして解凍。
- アーカイブをPHP7以上が動くWebサーバーへアップ。
- /appフォルダ以下に、
fw_simpleという名前でphp_fw_simpleのアーカイブをコピー。 - dataフォルダを書き込み可能にする。
- index.phpにアクセス。
- SSHでWebサーバーにログインする。
git clone --recursive https://github.com/kujirahand/Steppyコマンドを実行し、Gitのリポジトリをcloneするcd Steppyコマンドを実行し、cloneしたディレクトリに移動するmkdir cacheコマンドを実行し、キャッシュ用のディレクトリを作成するbash scripts/setup.shコマンドを実行する- 必要ライブラリのインストール
cd appそしてcomposer install ./n3s_config.ini.phpに以下のように情報を指定
<?php
global $n3s_config;
// 管理ユーザーのIDを配列で指定
$n3s_config['admin_users'] = [PHP_INT_MAX];
以下を実行してください。既存のリポジトリでエラーが出る場合も以下を実行してください。
git submodule update --init --recursive
なでしこ貯蔵庫と同じように運用するためには、WebサーバーのApacheにて下記の指定が必要です。.htaccessに下記の設定を記述してください。
<IfModule mod_rewrite.c>
RewriteEngine On
# plain
RewriteRule ^plain/([0-9a-zA-Z_\-]+).nako3$ /index.php?page=$1&action=plain&type=nako3 [L]
RewriteRule ^plain/([0-9a-zA-Z_\-]+).js$ /index.php?page=$1&action=plain&type=js [L]
RewriteRule ^plain/([0-9a-zA-Z_\-]+).(sh|csv|txt|json|bat)$ /index.php?page=$1&action=plain&type=$2 [L]
# version
RewriteRule ^nako_version.json$ /nako_version.php [L]
# new / list / edit / show
RewriteRule ^new$ /index.php?action=edit&page=new [L,R]
RewriteRule ^list$ /index.php?page=all&action=list [L]
RewriteRule ^edit/([0-9]+)$ /index.php?page=$1&action=edit [L,R]
RewriteRule ^show/([0-9a-zA-Z_\-]+)$ /index.php?page=$1&action=show [L,R]
# sourcemap
RewriteRule ^([0-9a-z_\-]+)\.js\.map$ /cdn.php?f=release/$1.js.map
</IfModule>
運用したいURL(n3s.example.com)に加えて、サンドボックスとして運用するURL(n3s-sandbox.example.com)を用意します。 そして、その2つのURLには全く同じコンテンツが表示されるように設定してください。 その上で、以下の設定を記述します。
// sandbox (末尾にスラッシュを追加)
$n3s_config['sandbox_url'] = 'https://n3s-sandbox.example.com/';
次のように記述することでガジェットをブログやHTMLに貼り付けできます。
<iframe width="232" height="320"
src="https://n3s.nadesi.com/widget.php?1">
</iframe>
srcにオプションrun=1やmute_name=1を追加すると実行ボタンを押すことなくスクリプトが実行されます。
<iframe width="232" height="320"
src="https://n3s.nadesi.com/widget.php?1&run=1&mute_name=1">
</iframe>
Webフォームから、以下のURLに body=xxx&version=(なでしこバージョン) をポストします。
<設置url>/index.php?page=0&action=presave
- POSTする値
- body --- プログラム本体
- version --- 利用なでしこのバージョン
<設置url>/api.php?action=show&page=(app_id)
GETでアクセスすると、プログラムと情報を取得できます。
id.php?(id)にアクセスするとindex.php?action=show&app_id=(id)にリダイレクトします。
設定ファイルn3s_config.ini.phpに、下記の項目を追加します。
$n3s_config['ng_words'] = ["aaaa","bbbbb","cccc",...]