From 5f5156561fe58b5d842e5505a2293bc94a732a72 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 15 Jul 2018 18:28:08 +0900 Subject: ドキュメントをMarkdownで書くように MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/docs/about.en.pug | 3 - src/client/docs/about.ja.pug | 3 - src/client/docs/api.ja.pug | 103 ---------------- src/client/docs/api/endpoints/style.styl | 21 ---- src/client/docs/api/endpoints/view.pug | 38 ------ src/client/docs/api/entities/drive-file.yaml | 73 ----------- src/client/docs/api/entities/note.yaml | 168 ------------------------- src/client/docs/api/entities/post.yaml | 168 ------------------------- src/client/docs/api/entities/style.styl | 1 - src/client/docs/api/entities/user.yaml | 177 --------------------------- src/client/docs/api/entities/view.pug | 20 --- src/client/docs/api/mixins.pug | 31 ----- src/client/docs/api/style.styl | 11 -- src/client/docs/follow.ja.pug | 9 -- src/client/docs/gulpfile.ts | 18 --- src/client/docs/index.en.pug | 3 - src/client/docs/index.ja.pug | 3 - src/client/docs/layout.pug | 41 ------- src/client/docs/license.en.pug | 17 --- src/client/docs/license.ja.pug | 17 --- src/client/docs/mute.ja.pug | 13 -- src/client/docs/search.ja.pug | 120 ------------------ src/client/docs/style.styl | 120 ------------------ src/client/docs/tou.ja.pug | 3 - src/client/docs/ui.styl | 19 --- src/docs/about.en.md | 3 + src/docs/about.ja.md | 3 + src/docs/api/endpoints/style.styl | 21 ++++ src/docs/api/endpoints/view.pug | 38 ++++++ src/docs/api/entities/drive-file.yaml | 73 +++++++++++ src/docs/api/entities/note.yaml | 168 +++++++++++++++++++++++++ src/docs/api/entities/post.yaml | 168 +++++++++++++++++++++++++ src/docs/api/entities/style.styl | 1 + src/docs/api/entities/user.yaml | 177 +++++++++++++++++++++++++++ src/docs/api/entities/view.pug | 20 +++ src/docs/api/mixins.pug | 31 +++++ src/docs/api/style.styl | 11 ++ src/docs/article.pug | 4 + src/docs/layout.pug | 41 +++++++ src/docs/style.styl | 120 ++++++++++++++++++ src/docs/ui.styl | 19 +++ src/server/web/docs.ts | 28 +++-- 42 files changed, 914 insertions(+), 1212 deletions(-) delete mode 100644 src/client/docs/about.en.pug delete mode 100644 src/client/docs/about.ja.pug delete mode 100644 src/client/docs/api.ja.pug delete mode 100644 src/client/docs/api/endpoints/style.styl delete mode 100644 src/client/docs/api/endpoints/view.pug delete mode 100644 src/client/docs/api/entities/drive-file.yaml delete mode 100644 src/client/docs/api/entities/note.yaml delete mode 100644 src/client/docs/api/entities/post.yaml delete mode 100644 src/client/docs/api/entities/style.styl delete mode 100644 src/client/docs/api/entities/user.yaml delete mode 100644 src/client/docs/api/entities/view.pug delete mode 100644 src/client/docs/api/mixins.pug delete mode 100644 src/client/docs/api/style.styl delete mode 100644 src/client/docs/follow.ja.pug delete mode 100644 src/client/docs/gulpfile.ts delete mode 100644 src/client/docs/index.en.pug delete mode 100644 src/client/docs/index.ja.pug delete mode 100644 src/client/docs/layout.pug delete mode 100644 src/client/docs/license.en.pug delete mode 100644 src/client/docs/license.ja.pug delete mode 100644 src/client/docs/mute.ja.pug delete mode 100644 src/client/docs/search.ja.pug delete mode 100644 src/client/docs/style.styl delete mode 100644 src/client/docs/tou.ja.pug delete mode 100644 src/client/docs/ui.styl create mode 100644 src/docs/about.en.md create mode 100644 src/docs/about.ja.md create mode 100644 src/docs/api/endpoints/style.styl create mode 100644 src/docs/api/endpoints/view.pug create mode 100644 src/docs/api/entities/drive-file.yaml create mode 100644 src/docs/api/entities/note.yaml create mode 100644 src/docs/api/entities/post.yaml create mode 100644 src/docs/api/entities/style.styl create mode 100644 src/docs/api/entities/user.yaml create mode 100644 src/docs/api/entities/view.pug create mode 100644 src/docs/api/mixins.pug create mode 100644 src/docs/api/style.styl create mode 100644 src/docs/article.pug create mode 100644 src/docs/layout.pug create mode 100644 src/docs/style.styl create mode 100644 src/docs/ui.styl (limited to 'src') diff --git a/src/client/docs/about.en.pug b/src/client/docs/about.en.pug deleted file mode 100644 index 893d9dd6a1..0000000000 --- a/src/client/docs/about.en.pug +++ /dev/null @@ -1,3 +0,0 @@ -h1 About Misskey - -p Misskey is a mini blog SNS. diff --git a/src/client/docs/about.ja.pug b/src/client/docs/about.ja.pug deleted file mode 100644 index fec933b0c6..0000000000 --- a/src/client/docs/about.ja.pug +++ /dev/null @@ -1,3 +0,0 @@ -h1 Misskeyについて - -p MisskeyはミニブログSNSです。 diff --git a/src/client/docs/api.ja.pug b/src/client/docs/api.ja.pug deleted file mode 100644 index 665cfdc4b8..0000000000 --- a/src/client/docs/api.ja.pug +++ /dev/null @@ -1,103 +0,0 @@ -h1 Misskey API - -p MisskeyはWeb APIを公開しており、様々な操作をプログラム上から行うことができます。 -p APIを自分のアカウントから利用する場合(自分のアカウントのみ操作したい場合)と、アプリケーションから利用する場合(不特定のアカウントを操作したい場合)とで利用手順が異なりますので、それぞれのケースについて説明します。 - -section - h2 自分の所有するアカウントからAPIにアクセスする場合 - p 「設定 > API」で、APIにアクセスするのに必要なAPIキーを取得してください。 - p APIにアクセスする際には、リクエストにAPIキーを「i」というパラメータ名で含めます。 - div.ui.info.warn: p %fa:exclamation-triangle%アカウントを不正利用される可能性があるため、このトークンは第三者に教えないでください(アプリなどにも入力しないでください)。 - p APIの詳しい使用法は「Misskey APIの利用」セクションをご覧ください。 - -section - h2 アプリケーションからAPIにアクセスする場合 - p - | 直接ユーザーのAPIキーをアプリケーションが扱うのは危険なので、 - | アプリケーションからAPIを利用する際には、アプリケーションとアプリケーションを利用するユーザーが結び付けられた専用のトークン(アクセストークン)をMisskeyに発行してもらい、 - | そのトークンをリクエストのパラメータに含める必要があります。 - div.ui.info: p %fa:info-circle%アクセストークンは、ユーザーが自分のアカウントにあなたのアプリケーションがアクセスすることを許可した場合のみ発行されます - - p それでは、アクセストークンを取得するまでの流れを説明します。 - - section - h3 1.アプリケーションを登録する - p まず、あなたのアプリケーションやWebサービス(以後、あなたのアプリと呼びます)をMisskeyに登録します。 - p - a(href=common.config.dev_url, target="_blank") デベロッパーセンター - | にアクセスし、「アプリ > アプリ作成」に進みます。 - | フォームに必要事項を記入し、アプリを作成してください。フォームの記入欄の説明は以下の通りです: - - table - thead - tr - th 名前 - th 説明 - tbody - tr - td アプリケーション名 - td あなたのアプリの名称。 - tr - td アプリの概要 - td あなたのアプリの簡単な説明や紹介。 - tr - td コールバックURL - td ユーザーが後述する認証フォームで認証を終えた際にリダイレクトするURLを設定できます。あなたのアプリがWebサービスである場合に有用です。 - tr - td 権限 - td あなたのアプリが要求する権限。ここで要求した機能だけがAPIからアクセスできます。 - - p 登録が済むとあなたのアプリのシークレットキーが入手できます。このシークレットキーは後で使用します。 - div.ui.info.warn: p %fa:exclamation-triangle%アプリに成りすまされる可能性があるため、極力このシークレットキーは公開しないようにしてください。 - - section - h3 2.ユーザーに認証させる - p あなたのアプリを使ってもらうには、ユーザーにアカウントへのアクセスの許可をもらう必要があります。 - p - | 認証セッションを開始するには、#{common.config.api_url}/auth/session/generate へパラメータに appSecret としてシークレットキーを含めたリクエストを送信します。 - | リクエスト形式はJSONで、メソッドはPOSTです。 - | レスポンスとして認証セッションのトークンや認証フォームのURLが取得できるので、認証フォームのURLをブラウザで表示し、ユーザーにフォームを提示してください。 - - p - | あなたのアプリがコールバックURLを設定している場合、 - | ユーザーがあなたのアプリの連携を許可すると設定しているコールバックURLに token という名前でセッションのトークンが含まれたクエリを付けてリダイレクトします。 - - p - | あなたのアプリがコールバックURLを設定していない場合、ユーザーがあなたのアプリの連携を許可したことを(何らかの方法で(たとえばボタンを押させるなど))確認出来るようにしてください。 - - section - h3 3.ユーザーのアクセストークンを取得する - p ユーザーが連携を許可したら、#{common.config.api_url}/auth/session/userkey へ次のパラメータを含むリクエストを送信します: - table - thead - tr - th 名前 - th 型 - th 説明 - tbody - tr - td appSecret - td string - td あなたのアプリのシークレットキー - tr - td token - td string - td セッションのトークン - p 上手くいけば、認証したユーザーのアクセストークンがレスポンスとして取得できます。おめでとうございます! - - p アクセストークンが取得できたら、「ユーザーのアクセストークン+あなたのアプリのシークレットキーをsha256したもの」を「i」というパラメータでリクエストに含めると、APIにアクセスすることができます。 - - p 「i」パラメータの生成方法を擬似コードで表すと次のようになります: - pre: code - | const i = sha256(accessToken + secretKey); - - p APIの詳しい使用法は「Misskey APIの利用」セクションをご覧ください。 - -section - h2 Misskey APIの利用 - p APIはすべてリクエストのパラメータ・レスポンスともにJSON形式です。また、すべてのエンドポイントはPOSTメソッドのみ受け付けます。 - p APIリファレンスもご確認ください。 - - section - h3 レートリミット - p Misskey APIにはレートリミットがあり、短時間のうちに多数のリクエストを送信すると、一定時間APIを利用することができなくなることがあります。 diff --git a/src/client/docs/api/endpoints/style.styl b/src/client/docs/api/endpoints/style.styl deleted file mode 100644 index 2af9fe9a77..0000000000 --- a/src/client/docs/api/endpoints/style.styl +++ /dev/null @@ -1,21 +0,0 @@ -@import "../style" - -#url - padding 8px 12px 8px 8px - font-family Consolas, 'Courier New', Courier, Monaco, monospace - color #fff - background #222e40 - border-radius 4px - - > .method - display inline-block - margin 0 8px 0 0 - padding 0 6px - color #f4fcff - background #17afc7 - border-radius 4px - user-select none - pointer-events none - - > .host - opacity 0.7 diff --git a/src/client/docs/api/endpoints/view.pug b/src/client/docs/api/endpoints/view.pug deleted file mode 100644 index e046b3fc33..0000000000 --- a/src/client/docs/api/endpoints/view.pug +++ /dev/null @@ -1,38 +0,0 @@ -extends ../../layout.pug -include ../mixins - -block meta - link(rel="stylesheet" href="/docs/assets/api/endpoints/style.css") - -block main - h1= endpoint - - p#url - span.method POST - span.host - = url.host - | / - span.path= url.path - - p#desc= desc[lang] || desc['ja'] - - section - h2= i18n('docs.api.endpoints.params') - +propTable(params) - - if paramDefs - each paramDef in paramDefs - section(id= paramDef.name) - h3= paramDef.name - +propTable(paramDef.params) - - if res - section - h2= i18n('docs.api.endpoints.res') - +propTable(res) - - if resDefs - each resDef in resDefs - section(id= resDef.name) - h3= resDef.name - +propTable(resDef.props) diff --git a/src/client/docs/api/entities/drive-file.yaml b/src/client/docs/api/entities/drive-file.yaml deleted file mode 100644 index 02ab0d608e..0000000000 --- a/src/client/docs/api/entities/drive-file.yaml +++ /dev/null @@ -1,73 +0,0 @@ -name: "DriveFile" - -desc: - ja: "ドライブのファイル。" - en: "A file of Drive." - -props: - - name: "id" - type: "id" - optional: false - desc: - ja: "ファイルID" - en: "The ID of this file" - - name: "createdAt" - type: "date" - optional: false - desc: - ja: "アップロード日時" - en: "The upload date of this file" - - name: "userId" - type: "id(User)" - optional: false - desc: - ja: "所有者ID" - en: "The ID of the owner of this file" - - name: "user" - type: "entity(User)" - optional: true - desc: - ja: "所有者" - en: "The owner of this file" - - name: "name" - type: "string" - optional: false - desc: - ja: "ファイル名" - en: "The name of this file" - - name: "md5" - type: "string" - optional: false - desc: - ja: "ファイルのMD5ハッシュ値" - en: "The md5 hash value of this file" - - name: "type" - type: "string" - optional: false - desc: - ja: "ファイルの種類" - en: "The type of this file" - - name: "datasize" - type: "number" - optional: false - desc: - ja: "ファイルサイズ(bytes)" - en: "The size of this file (bytes)" - - name: "url" - type: "string" - optional: false - desc: - ja: "ファイルのURL" - en: "The URL of this file" - - name: "folderId" - type: "id(DriveFolder)" - optional: true - desc: - ja: "フォルダID" - en: "The ID of the folder of this file" - - name: "folder" - type: "entity(DriveFolder)" - optional: true - desc: - ja: "フォルダ" - en: "The folder of this file" diff --git a/src/client/docs/api/entities/note.yaml b/src/client/docs/api/entities/note.yaml deleted file mode 100644 index c508dab3db..0000000000 --- a/src/client/docs/api/entities/note.yaml +++ /dev/null @@ -1,168 +0,0 @@ -name: "Note" - -desc: - ja: "投稿。" - en: "A note." - -props: - - name: "id" - type: "id" - optional: false - desc: - ja: "投稿ID" - en: "The ID of this note" - - name: "createdAt" - type: "date" - optional: false - desc: - ja: "投稿日時" - en: "The posted date of this note" - - name: "viaMobile" - type: "boolean" - optional: true - desc: - ja: "モバイル端末から投稿したか否か(自己申告であることに留意)" - en: "Whether this note sent via a mobile device" - - name: "text" - type: "string" - optional: true - desc: - ja: "投稿の本文" - en: "The text of this note" - - name: "mediaIds" - type: "id(DriveFile)[]" - optional: true - desc: - ja: "添付されているメディアのID (なければレスポンスでは空配列)" - en: "The IDs of the attached media (empty array for response if no media is attached)" - - name: "media" - type: "entity(DriveFile)[]" - optional: true - desc: - ja: "添付されているメディア" - en: "The attached media" - - name: "userId" - type: "id(User)" - optional: false - desc: - ja: "投稿者ID" - en: "The ID of author of this note" - - name: "user" - type: "entity(User)" - optional: true - desc: - ja: "投稿者" - en: "The author of this note" - - name: "myReaction" - type: "string" - optional: true - desc: - ja: "この投稿に対する自分のリアクション" - en: "The your reaction of this note" - - name: "reactionCounts" - type: "object" - optional: false - desc: - ja: "リアクションをキーとし、この投稿に対するそのリアクションの数を値としたオブジェクト" - - name: "replyId" - type: "id(Note)" - optional: true - desc: - ja: "返信した投稿のID" - en: "The ID of the replyed note" - - name: "reply" - type: "entity(Note)" - optional: true - desc: - ja: "返信した投稿" - en: "The replyed note" - - name: "renoteId" - type: "id(Note)" - optional: true - desc: - ja: "引用した投稿のID" - en: "The ID of the quoted note" - - name: "renote" - type: "entity(Note)" - optional: true - desc: - ja: "引用した投稿" - en: "The quoted note" - - name: "poll" - type: "object" - optional: true - desc: - ja: "投票" - en: "The poll" - defName: "poll" - def: - - name: "choices" - type: "object[]" - optional: false - desc: - ja: "投票の選択肢" - en: "The choices of this poll" - defName: "choice" - def: - - name: "id" - type: "number" - optional: false - desc: - ja: "選択肢ID" - en: "The ID of this choice" - - name: "isVoted" - type: "boolean" - optional: true - desc: - ja: "自分がこの選択肢に投票したかどうか" - en: "Whether you voted to this choice" - - name: "text" - type: "string" - optional: false - desc: - ja: "選択肢本文" - en: "The text of this choice" - - name: "votes" - type: "number" - optional: false - desc: - ja: "この選択肢に投票された数" - en: "The number voted for this choice" - - name: "geo" - type: "object" - optional: true - desc: - ja: "位置情報" - en: "Geo location" - defName: "geo" - def: - - name: "coordinates" - type: "number[]" - optional: false - desc: - ja: "座標。最初に経度:-180〜180で表す。最後に緯度:-90〜90で表す。" - - name: "altitude" - type: "number" - optional: false - desc: - ja: "高度。メートル単位で表す。" - - name: "accuracy" - type: "number" - optional: false - desc: - ja: "緯度、経度の精度。メートル単位で表す。" - - name: "altitudeAccuracy" - type: "number" - optional: false - desc: - ja: "高度の精度。メートル単位で表す。" - - name: "heading" - type: "number" - optional: false - desc: - ja: "方角。0〜360の角度で表す。0が北、90が東、180が南、270が西。" - - name: "speed" - type: "number" - optional: false - desc: - ja: "速度。メートル / 秒数で表す。" diff --git a/src/client/docs/api/entities/post.yaml b/src/client/docs/api/entities/post.yaml deleted file mode 100644 index 6fd26543bb..0000000000 --- a/src/client/docs/api/entities/post.yaml +++ /dev/null @@ -1,168 +0,0 @@ -name: "Note" - -desc: - ja: "投稿。" - en: "A note." - -props: - - name: "id" - type: "id" - optional: false - desc: - ja: "投稿ID" - en: "The ID of this note" - - name: "createdAt" - type: "date" - optional: false - desc: - ja: "投稿日時" - en: "The posted date of this note" - - name: "viaMobile" - type: "boolean" - optional: true - desc: - ja: "モバイル端末から投稿したか否か(自己申告であることに留意)" - en: "Whether this note sent via a mobile device" - - name: "text" - type: "string" - optional: true - desc: - ja: "投稿の本文 (ローカルの場合Markdown風のフォーマット)" - en: "The text of this note (in Markdown like format if local)" - - name: "mediaIds" - type: "id(DriveFile)[]" - optional: true - desc: - ja: "添付されているメディアのID (なければレスポンスでは空配列)" - en: "The IDs of the attached media (empty array for response if no media is attached)" - - name: "media" - type: "entity(DriveFile)[]" - optional: true - desc: - ja: "添付されているメディア" - en: "The attached media" - - name: "userId" - type: "id(User)" - optional: false - desc: - ja: "投稿者ID" - en: "The ID of author of this note" - - name: "user" - type: "entity(User)" - optional: true - desc: - ja: "投稿者" - en: "The author of this note" - - name: "myReaction" - type: "string" - optional: true - desc: - ja: "この投稿に対する自分のリアクション" - en: "The your reaction of this note" - - name: "reactionCounts" - type: "object" - optional: false - desc: - ja: "リアクションをキーとし、この投稿に対するそのリアクションの数を値としたオブジェクト" - - name: "replyId" - type: "id(Note)" - optional: true - desc: - ja: "返信した投稿のID" - en: "The ID of the replyed note" - - name: "reply" - type: "entity(Note)" - optional: true - desc: - ja: "返信した投稿" - en: "The replyed note" - - name: "renoteId" - type: "id(Note)" - optional: true - desc: - ja: "引用した投稿のID" - en: "The ID of the quoted note" - - name: "renote" - type: "entity(Note)" - optional: true - desc: - ja: "引用した投稿" - en: "The quoted note" - - name: "poll" - type: "object" - optional: true - desc: - ja: "投票" - en: "The poll" - defName: "poll" - def: - - name: "choices" - type: "object[]" - optional: false - desc: - ja: "投票の選択肢" - en: "The choices of this poll" - defName: "choice" - def: - - name: "id" - type: "number" - optional: false - desc: - ja: "選択肢ID" - en: "The ID of this choice" - - name: "isVoted" - type: "boolean" - optional: true - desc: - ja: "自分がこの選択肢に投票したかどうか" - en: "Whether you voted to this choice" - - name: "text" - type: "string" - optional: false - desc: - ja: "選択肢本文" - en: "The text of this choice" - - name: "votes" - type: "number" - optional: false - desc: - ja: "この選択肢に投票された数" - en: "The number voted for this choice" - - name: "geo" - type: "object" - optional: true - desc: - ja: "位置情報" - en: "Geo location" - defName: "geo" - def: - - name: "coordinates" - type: "number[]" - optional: false - desc: - ja: "座標。最初に経度:-180〜180で表す。最後に緯度:-90〜90で表す。" - - name: "altitude" - type: "number" - optional: false - desc: - ja: "高度。メートル単位で表す。" - - name: "accuracy" - type: "number" - optional: false - desc: - ja: "緯度、経度の精度。メートル単位で表す。" - - name: "altitudeAccuracy" - type: "number" - optional: false - desc: - ja: "高度の精度。メートル単位で表す。" - - name: "heading" - type: "number" - optional: false - desc: - ja: "方角。0〜360の角度で表す。0が北、90が東、180が南、270が西。" - - name: "speed" - type: "number" - optional: false - desc: - ja: "速度。メートル / 秒数で表す。" diff --git a/src/client/docs/api/entities/style.styl b/src/client/docs/api/entities/style.styl deleted file mode 100644 index bddf0f53ab..0000000000 --- a/src/client/docs/api/entities/style.styl +++ /dev/null @@ -1 +0,0 @@ -@import "../style" diff --git a/src/client/docs/api/entities/user.yaml b/src/client/docs/api/entities/user.yaml deleted file mode 100644 index 3328734d2b..0000000000 --- a/src/client/docs/api/entities/user.yaml +++ /dev/null @@ -1,177 +0,0 @@ -name: "User" - -desc: - ja: "ユーザー。" - en: "A user." - -props: - id: - type: "id" - optional: false - desc: - ja: "ユーザーID" - en: "The ID of this user" - - createdAt: - type: "date" - optional: false - desc: - ja: "アカウント作成日時" - en: "The registered date of this user" - - username: - type: "string" - optional: false - desc: - ja: "ユーザー名" - en: "The username of this user" - - description: - type: "string" - optional: false - desc: - ja: "アカウントの説明(自己紹介)" - en: "The description of this user" - - avatarId: - type: "id(DriveFile)" - optional: true - desc: - ja: "アバターのID" - en: "The ID of the avatar of this user" - - avatarUrl: - type: "string" - optional: false - desc: - ja: "アバターのURL" - en: "The URL of the avatar of this user" - - bannerId: - type: "id(DriveFile)" - optional: true - desc: - ja: "バナーのID" - en: "The ID of the banner of this user" - - bannerUrl: - type: "string" - optional: false - desc: - ja: "バナーのURL" - en: "The URL of the banner of this user" - - followersCount: - type: "number" - optional: false - desc: - ja: "フォロワーの数" - en: "The number of the followers for this user" - - followingCount: - type: "number" - optional: false - desc: - ja: "フォローしているユーザーの数" - en: "The number of the following users for this user" - - isFollowing: - type: "boolean" - optional: true - desc: - ja: "自分がこのユーザーをフォローしているか" - - isFollowed: - type: "boolean" - optional: true - desc: - ja: "自分がこのユーザーにフォローされているか" - - isMuted: - type: "boolean" - optional: true - desc: - ja: "自分がこのユーザーをミュートしているか" - en: "Whether you muted this user" - - notesCount: - type: "number" - optional: false - desc: - ja: "投稿の数" - en: "The number of the notes of this user" - - pinnedNote: - type: "entity(Note)" - optional: true - desc: - ja: "ピン留めされた投稿" - en: "The pinned note of this user" - - pinnedNoteId: - type: "id(Note)" - optional: true - desc: - ja: "ピン留めされた投稿のID" - en: "The ID of the pinned note of this user" - - driveCapacity: - type: "number" - optional: false - desc: - ja: "ドライブの容量(bytes)" - en: "The capacity of drive of this user (bytes)" - - host: - type: "string | null" - optional: false - desc: - ja: "ホスト (例: example.com:3000)" - en: "Host (e.g. example.com:3000)" - - twitter: - type: "object" - optional: true - desc: - ja: "連携されているTwitterアカウント情報" - en: "The info of the connected twitter account of this user" - props: - userId: - type: "string" - optional: false - desc: - ja: "ユーザーID" - en: "The user ID" - screenName: - type: "string" - optional: false - desc: - ja: "ユーザー名" - en: "The screen name of this user" - - isBot: - type: "boolean" - optional: true - desc: - ja: "botか否か(自己申告であることに留意)" - en: "Whether is bot or not" - - profile: - type: "object" - optional: false - desc: - ja: "プロフィール" - en: "The profile of this user" - props: - location: - type: "string" - optional: true - desc: - ja: "場所" - en: "The location of this user" - birthday: - type: "string" - optional: true - desc: - ja: "誕生日 (YYYY-MM-DD)" - en: "The birthday of this user (YYYY-MM-DD)" diff --git a/src/client/docs/api/entities/view.pug b/src/client/docs/api/entities/view.pug deleted file mode 100644 index 3f50bfd3bd..0000000000 --- a/src/client/docs/api/entities/view.pug +++ /dev/null @@ -1,20 +0,0 @@ -extends ../../layout.pug -include ../mixins - -block meta - link(rel="stylesheet" href="/docs/assets/api/entities/style.css") - -block main - h1= name - - p#desc= desc[lang] || desc['ja'] - - section - h2= i18n('docs.api.entities.properties') - +propTable(props) - - if propDefs - each propDef in propDefs - section(id= propDef.name) - h3= propDef.name - +propTable(propDef.props) diff --git a/src/client/docs/api/mixins.pug b/src/client/docs/api/mixins.pug deleted file mode 100644 index 9e03abefeb..0000000000 --- a/src/client/docs/api/mixins.pug +++ /dev/null @@ -1,31 +0,0 @@ -mixin propTable(props) - table.props - thead: tr - th= i18n('docs.api.props.name') - th= i18n('docs.api.props.type') - th= i18n('docs.api.props.description') - tbody - each prop in props - tr - td.name= prop.name - td.type - i= prop.type - if prop.kind == 'id' - if prop.entity - | ( - a(href=`/docs/${lang}/api/entities/${kebab(prop.entity)}`)= prop.entity - | ID) - else - | (ID) - else if prop.kind == 'entity' - | ( - a(href=`/docs/${lang}/api/entities/${kebab(prop.entity)}`)= prop.entity - | ) - else if prop.kind == 'object' - if prop.hasDef - | ( - a(href=`#${prop.name}`)= prop.name - | ) - else if prop.kind == 'date' - | (Date) - td.desc!= prop.desc ? prop.desc[lang] || prop.desc['ja'] : null diff --git a/src/client/docs/api/style.styl b/src/client/docs/api/style.styl deleted file mode 100644 index 3675a4da6f..0000000000 --- a/src/client/docs/api/style.styl +++ /dev/null @@ -1,11 +0,0 @@ -@import "../style" - -table.props - .name - font-weight bold - - .name - .type - .optional - font-family Consolas, 'Courier New', Courier, Monaco, monospace - diff --git a/src/client/docs/follow.ja.pug b/src/client/docs/follow.ja.pug deleted file mode 100644 index f0e83bc8fd..0000000000 --- a/src/client/docs/follow.ja.pug +++ /dev/null @@ -1,9 +0,0 @@ -h1 フォロー -p ユーザーをフォローすると、タイムラインにそのユーザーの投稿が表示されるようになります。ただし、他のユーザーに対する返信は含まれません。 -p ユーザーをフォローするには、ユーザーページの「フォロー」ボタンをクリックします。フォローを解除するには、もう一度クリックします。 - -section - h2 ストーキング - p ユーザーをフォローしている状態では、さらに「ストーキング」モードをオンにすることができます。ストーキングを行うと、タイムラインにそのユーザーの全ての投稿が表示されるようになります。つまり、他のユーザーに対する返信も含まれることになります。 - p ストーキングするには、ユーザーページの「ストークする」をクリックします。ストーキングをやめるには、もう一度クリックします。 - p ストーキングしていることは相手に通知されません。 diff --git a/src/client/docs/gulpfile.ts b/src/client/docs/gulpfile.ts deleted file mode 100644 index 2a95dfbfee..0000000000 --- a/src/client/docs/gulpfile.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Gulp tasks - */ - -import * as gulp from 'gulp'; -const stylus = require('gulp-stylus'); -const cssnano = require('gulp-cssnano'); - -gulp.task('doc', [ - 'doc:styles' -]); - -gulp.task('doc:styles', () => - gulp.src('./src/client/docs/**/*.styl') - .pipe(stylus()) - .pipe((cssnano as any)()) - .pipe(gulp.dest('./built/client/docs/assets/')) -); diff --git a/src/client/docs/index.en.pug b/src/client/docs/index.en.pug deleted file mode 100644 index 1fcc870d3d..0000000000 --- a/src/client/docs/index.en.pug +++ /dev/null @@ -1,3 +0,0 @@ -h1 Misskey Docs - -p Welcome to docs of Misskey. diff --git a/src/client/docs/index.ja.pug b/src/client/docs/index.ja.pug deleted file mode 100644 index 4a0bf7fa1d..0000000000 --- a/src/client/docs/index.ja.pug +++ /dev/null @@ -1,3 +0,0 @@ -h1 Misskey ドキュメント - -p Misskeyのドキュメントへようこそ diff --git a/src/client/docs/layout.pug b/src/client/docs/layout.pug deleted file mode 100644 index 4186d2d365..0000000000 --- a/src/client/docs/layout.pug +++ /dev/null @@ -1,41 +0,0 @@ -doctype html - -html(lang= lang) - head - meta(charset="UTF-8") - meta(name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no") - title - | #{title} | Misskey Docs - link(rel="stylesheet" href="/docs/assets/style.css") - block meta - - //- FontAwesome style - style #{facss} - - body - nav - ul - each doc in docs - li: a(href=`/docs/${lang}/${doc.name}`)= doc.title[lang] || doc.title['ja'] - section - h2 API - ul - li Entities - ul - each entity in entities - li: a(href=`/docs/${lang}/api/entities/${kebab(entity)}`)= entity - li Endpoints - ul - each endpoint in endpoints - li: a(href=`/docs/${lang}/api/endpoints/${kebab(endpoint)}`)= endpoint - main - article - block main - if content - | !{content} - - footer - p - | %i18n:docs.edit-this-page-on-github% - a(href=src target="_blank") %i18n:docs.edit-this-page-on-github-link% - small= copyright diff --git a/src/client/docs/license.en.pug b/src/client/docs/license.en.pug deleted file mode 100644 index 45d8b76473..0000000000 --- a/src/client/docs/license.en.pug +++ /dev/null @@ -1,17 +0,0 @@ -h1 License - -div!= common.license - -details - summary Libraries - - section - h2 Libraries - - each dependency, name in common.dependencies - details - summary= name - - section - h3= name - pre= dependency.licenseText diff --git a/src/client/docs/license.ja.pug b/src/client/docs/license.ja.pug deleted file mode 100644 index 6eb9ac308e..0000000000 --- a/src/client/docs/license.ja.pug +++ /dev/null @@ -1,17 +0,0 @@ -h1 ライセンス - -div!= common.license - -details - summary サードパーティ - - section - h2 サードパーティ - - each dependency, name in common.dependencies - details - summary= name - - section - h3= name - pre= dependency.licenseText diff --git a/src/client/docs/mute.ja.pug b/src/client/docs/mute.ja.pug deleted file mode 100644 index 807f7b67a7..0000000000 --- a/src/client/docs/mute.ja.pug +++ /dev/null @@ -1,13 +0,0 @@ -h1 ミュート - -p ユーザーページから、そのユーザーをミュートすることができます。 - -p ユーザーをミュートすると、そのユーザーに関する次のコンテンツがMisskeyに表示されなくなります: -ul - li タイムラインや投稿の検索結果内の、そのユーザーの投稿(およびそれらの投稿に対する返信やRenote) - li そのユーザーからの通知 - li メッセージ履歴一覧内の、そのユーザーとのメッセージ履歴 - -p ミュートを行ったことは相手に通知されず、ミュートされていることを知ることもできません。 - -p 設定>ミュート から、自分がミュートしているユーザー一覧を確認することができます。 diff --git a/src/client/docs/search.ja.pug b/src/client/docs/search.ja.pug deleted file mode 100644 index fc62d16cae..0000000000 --- a/src/client/docs/search.ja.pug +++ /dev/null @@ -1,120 +0,0 @@ -h1 検索 - -p 投稿を検索することができます。 -p - | キーワードを半角スペースで区切ると、and検索になります。 - | 例えば、「git コミット」と検索すると、「gitで編集したファイルの特定の行だけコミットする方法がわからない」などがマッチします。 - -section - h2 キーワードの除外 - p キーワードの前に「-」(ハイフン)をプリフィクスすると、そのキーワードを含まない投稿に限定します。 - p 例えば、「gitというキーワードを含むが、コミットというキーワードは含まない投稿」を検索したい場合、クエリは以下のようになります: - code git -コミット - -section - h2 完全一致 - p テキストを「"""」で囲むと、そのテキストと完全に一致する投稿を検索します。 - p 例えば、「"""にゃーん"""」と検索すると、「にゃーん」という投稿のみがヒットし、「にゃーん…」という投稿はヒットしません。 - -section - h2 タグ - p キーワードの前に「#」(シャープ)をプリフィクスすると、そのキーワードと一致するタグを持つ投稿に限定します。 - -section - h2 オプション - p - | オプションを使用して、より高度な検索を行えます。 - | オプションを指定するには、「オプション名:値」という形式でクエリに含めます。 - p 利用可能なオプション一覧です: - - table - thead - tr - th 名前 - th 説明 - tbody - tr - td user - td - | 指定されたユーザー名のユーザーの投稿に限定します。 - | 「,」(カンマ)で区切って、複数ユーザーを指定することもできます。 - br - | 例えば、 - code user:himawari,sakurako - | と検索すると「@himawariまたは@sakurakoの投稿」だけに限定します。 - | (つまりユーザーのホワイトリストです) - tr - td exclude_user - td - | 指定されたユーザー名のユーザーの投稿を除外します。 - | 「,」(カンマ)で区切って、複数ユーザーを指定することもできます。 - br - | 例えば、 - code exclude_user:akari,chinatsu - | と検索すると「@akariまたは@chinatsu以外の投稿」に限定します。 - | (つまりユーザーのブラックリストです) - tr - td follow - td - | true ... フォローしているユーザーに限定。 - br - | false ... フォローしていないユーザーに限定。 - br - | null ... 特に限定しない(デフォルト) - tr - td mute - td - | mute_all ... ミュートしているユーザーの投稿とその投稿に対する返信やRenoteを除外する(デフォルト) - br - | mute_related ... ミュートしているユーザーの投稿に対する返信やRenoteだけ除外する - br - | mute_direct ... ミュートしているユーザーの投稿だけ除外する - br - | disabled ... ミュートしているユーザーの投稿とその投稿に対する返信やRenoteも含める - br - | direct_only ... ミュートしているユーザーの投稿だけに限定 - br - | related_only ... ミュートしているユーザーの投稿に対する返信やRenoteだけに限定 - br - | all_only ... ミュートしているユーザーの投稿とその投稿に対する返信やRenoteに限定 - tr - td reply - td - | true ... 返信に限定。 - br - | false ... 返信でない投稿に限定。 - br - | null ... 特に限定しない(デフォルト) - tr - td renote - td - | true ... Renoteに限定。 - br - | false ... Renoteでない投稿に限定。 - br - | null ... 特に限定しない(デフォルト) - tr - td media - td - | true ... メディアが添付されている投稿に限定。 - br - | false ... メディアが添付されていない投稿に限定。 - br - | null ... 特に限定しない(デフォルト) - tr - td poll - td - | true ... 投票が添付されている投稿に限定。 - br - | false ... 投票が添付されていない投稿に限定。 - br - | null ... 特に限定しない(デフォルト) - tr - td until - td 上限の日時。(YYYY-MM-DD) - tr - td since - td 下限の日時。(YYYY-MM-DD) - - p 例えば、「@syuiloの2017年11月1日から2017年12月31日までの『Misskey』というテキストを含む返信ではない投稿」を検索したい場合、クエリは以下のようになります: - code user:syuilo since:2017-11-01 until:2017-12-31 reply:false Misskey diff --git a/src/client/docs/style.styl b/src/client/docs/style.styl deleted file mode 100644 index 3b13617588..0000000000 --- a/src/client/docs/style.styl +++ /dev/null @@ -1,120 +0,0 @@ -@import "../style" -@import "./ui" - -body - margin 0 - color #34495e - word-break break-word - -main - margin 0 0 0 256px - padding 64px - width 100% - max-width 800px - - section - margin 32px 0 - - h1 - margin 0 0 24px 0 - padding 16px 0 - font-size 1.5em - border-bottom solid 2px #eee - - h2 - margin 0 0 24px 0 - padding 0 0 16px 0 - font-size 1.4em - border-bottom solid 1px #eee - - h3 - margin 0 - padding 0 - font-size 1.25em - - h4 - margin 0 - - p - margin 1em 0 - line-height 1.6em - - footer - margin 32px 0 0 0 - border-top solid 2px #eee - - > small - margin 16px 0 0 0 - color #aaa - -nav - display block - position fixed - z-index 10000 - top 0 - left 0 - width 256px - height 100% - overflow auto - padding 32px - background #fff - border-right solid 2px #eee - -@media (max-width 1025px) - main - margin 0 - max-width 100% - - nav - position relative - width 100% - max-height 128px - background #f9f9f9 - border-right none - -@media (max-width 768px) - main - padding 32px - -@media (max-width 512px) - main - padding 16px - -table - display block - width 100% - max-width 100% - overflow auto - border-spacing 0 - border-collapse collapse - - thead - font-weight bold - border-bottom solid 2px #eee - - tr - th - text-align left - - tbody - tr - &:nth-child(odd) - background #fbfbfb - - th, td - padding 8px 16px - min-width 128px - -code - display inline-block - padding 8px 10px - font-family Consolas, 'Courier New', Courier, Monaco, monospace - color #295c92 - background #f2f2f2 - border-radius 4px - -pre - overflow auto - - > code - display block diff --git a/src/client/docs/tou.ja.pug b/src/client/docs/tou.ja.pug deleted file mode 100644 index 7663258f82..0000000000 --- a/src/client/docs/tou.ja.pug +++ /dev/null @@ -1,3 +0,0 @@ -h1 利用規約 - -p 公序良俗に反する行為はおやめください。 diff --git a/src/client/docs/ui.styl b/src/client/docs/ui.styl deleted file mode 100644 index 8d5515712f..0000000000 --- a/src/client/docs/ui.styl +++ /dev/null @@ -1,19 +0,0 @@ -.ui.info - display block - margin 1em 0 - padding 0 1em - font-size 90% - color rgba(#000, 0.87) - background #f8f8f9 - border-radius 4px - overflow hidden - - > p - opacity 0.8 - - > [data-fa]:first-child - margin-right 0.25em - - &.warn - color #573a08 - background #FFFAF3 diff --git a/src/docs/about.en.md b/src/docs/about.en.md new file mode 100644 index 0000000000..bb1c51927b --- /dev/null +++ b/src/docs/about.en.md @@ -0,0 +1,3 @@ +# About Misskey + +Misskey is a mini blog SNS. diff --git a/src/docs/about.ja.md b/src/docs/about.ja.md new file mode 100644 index 0000000000..1b06361f0f --- /dev/null +++ b/src/docs/about.ja.md @@ -0,0 +1,3 @@ +# Misskeyについて + +MisskeyはミニブログSNSです。 diff --git a/src/docs/api/endpoints/style.styl b/src/docs/api/endpoints/style.styl new file mode 100644 index 0000000000..2af9fe9a77 --- /dev/null +++ b/src/docs/api/endpoints/style.styl @@ -0,0 +1,21 @@ +@import "../style" + +#url + padding 8px 12px 8px 8px + font-family Consolas, 'Courier New', Courier, Monaco, monospace + color #fff + background #222e40 + border-radius 4px + + > .method + display inline-block + margin 0 8px 0 0 + padding 0 6px + color #f4fcff + background #17afc7 + border-radius 4px + user-select none + pointer-events none + + > .host + opacity 0.7 diff --git a/src/docs/api/endpoints/view.pug b/src/docs/api/endpoints/view.pug new file mode 100644 index 0000000000..e046b3fc33 --- /dev/null +++ b/src/docs/api/endpoints/view.pug @@ -0,0 +1,38 @@ +extends ../../layout.pug +include ../mixins + +block meta + link(rel="stylesheet" href="/docs/assets/api/endpoints/style.css") + +block main + h1= endpoint + + p#url + span.method POST + span.host + = url.host + | / + span.path= url.path + + p#desc= desc[lang] || desc['ja'] + + section + h2= i18n('docs.api.endpoints.params') + +propTable(params) + + if paramDefs + each paramDef in paramDefs + section(id= paramDef.name) + h3= paramDef.name + +propTable(paramDef.params) + + if res + section + h2= i18n('docs.api.endpoints.res') + +propTable(res) + + if resDefs + each resDef in resDefs + section(id= resDef.name) + h3= resDef.name + +propTable(resDef.props) diff --git a/src/docs/api/entities/drive-file.yaml b/src/docs/api/entities/drive-file.yaml new file mode 100644 index 0000000000..02ab0d608e --- /dev/null +++ b/src/docs/api/entities/drive-file.yaml @@ -0,0 +1,73 @@ +name: "DriveFile" + +desc: + ja: "ドライブのファイル。" + en: "A file of Drive." + +props: + - name: "id" + type: "id" + optional: false + desc: + ja: "ファイルID" + en: "The ID of this file" + - name: "createdAt" + type: "date" + optional: false + desc: + ja: "アップロード日時" + en: "The upload date of this file" + - name: "userId" + type: "id(User)" + optional: false + desc: + ja: "所有者ID" + en: "The ID of the owner of this file" + - name: "user" + type: "entity(User)" + optional: true + desc: + ja: "所有者" + en: "The owner of this file" + - name: "name" + type: "string" + optional: false + desc: + ja: "ファイル名" + en: "The name of this file" + - name: "md5" + type: "string" + optional: false + desc: + ja: "ファイルのMD5ハッシュ値" + en: "The md5 hash value of this file" + - name: "type" + type: "string" + optional: false + desc: + ja: "ファイルの種類" + en: "The type of this file" + - name: "datasize" + type: "number" + optional: false + desc: + ja: "ファイルサイズ(bytes)" + en: "The size of this file (bytes)" + - name: "url" + type: "string" + optional: false + desc: + ja: "ファイルのURL" + en: "The URL of this file" + - name: "folderId" + type: "id(DriveFolder)" + optional: true + desc: + ja: "フォルダID" + en: "The ID of the folder of this file" + - name: "folder" + type: "entity(DriveFolder)" + optional: true + desc: + ja: "フォルダ" + en: "The folder of this file" diff --git a/src/docs/api/entities/note.yaml b/src/docs/api/entities/note.yaml new file mode 100644 index 0000000000..c508dab3db --- /dev/null +++ b/src/docs/api/entities/note.yaml @@ -0,0 +1,168 @@ +name: "Note" + +desc: + ja: "投稿。" + en: "A note." + +props: + - name: "id" + type: "id" + optional: false + desc: + ja: "投稿ID" + en: "The ID of this note" + - name: "createdAt" + type: "date" + optional: false + desc: + ja: "投稿日時" + en: "The posted date of this note" + - name: "viaMobile" + type: "boolean" + optional: true + desc: + ja: "モバイル端末から投稿したか否か(自己申告であることに留意)" + en: "Whether this note sent via a mobile device" + - name: "text" + type: "string" + optional: true + desc: + ja: "投稿の本文" + en: "The text of this note" + - name: "mediaIds" + type: "id(DriveFile)[]" + optional: true + desc: + ja: "添付されているメディアのID (なければレスポンスでは空配列)" + en: "The IDs of the attached media (empty array for response if no media is attached)" + - name: "media" + type: "entity(DriveFile)[]" + optional: true + desc: + ja: "添付されているメディア" + en: "The attached media" + - name: "userId" + type: "id(User)" + optional: false + desc: + ja: "投稿者ID" + en: "The ID of author of this note" + - name: "user" + type: "entity(User)" + optional: true + desc: + ja: "投稿者" + en: "The author of this note" + - name: "myReaction" + type: "string" + optional: true + desc: + ja: "この投稿に対する自分のリアクション" + en: "The your reaction of this note" + - name: "reactionCounts" + type: "object" + optional: false + desc: + ja: "リアクションをキーとし、この投稿に対するそのリアクションの数を値としたオブジェクト" + - name: "replyId" + type: "id(Note)" + optional: true + desc: + ja: "返信した投稿のID" + en: "The ID of the replyed note" + - name: "reply" + type: "entity(Note)" + optional: true + desc: + ja: "返信した投稿" + en: "The replyed note" + - name: "renoteId" + type: "id(Note)" + optional: true + desc: + ja: "引用した投稿のID" + en: "The ID of the quoted note" + - name: "renote" + type: "entity(Note)" + optional: true + desc: + ja: "引用した投稿" + en: "The quoted note" + - name: "poll" + type: "object" + optional: true + desc: + ja: "投票" + en: "The poll" + defName: "poll" + def: + - name: "choices" + type: "object[]" + optional: false + desc: + ja: "投票の選択肢" + en: "The choices of this poll" + defName: "choice" + def: + - name: "id" + type: "number" + optional: false + desc: + ja: "選択肢ID" + en: "The ID of this choice" + - name: "isVoted" + type: "boolean" + optional: true + desc: + ja: "自分がこの選択肢に投票したかどうか" + en: "Whether you voted to this choice" + - name: "text" + type: "string" + optional: false + desc: + ja: "選択肢本文" + en: "The text of this choice" + - name: "votes" + type: "number" + optional: false + desc: + ja: "この選択肢に投票された数" + en: "The number voted for this choice" + - name: "geo" + type: "object" + optional: true + desc: + ja: "位置情報" + en: "Geo location" + defName: "geo" + def: + - name: "coordinates" + type: "number[]" + optional: false + desc: + ja: "座標。最初に経度:-180〜180で表す。最後に緯度:-90〜90で表す。" + - name: "altitude" + type: "number" + optional: false + desc: + ja: "高度。メートル単位で表す。" + - name: "accuracy" + type: "number" + optional: false + desc: + ja: "緯度、経度の精度。メートル単位で表す。" + - name: "altitudeAccuracy" + type: "number" + optional: false + desc: + ja: "高度の精度。メートル単位で表す。" + - name: "heading" + type: "number" + optional: false + desc: + ja: "方角。0〜360の角度で表す。0が北、90が東、180が南、270が西。" + - name: "speed" + type: "number" + optional: false + desc: + ja: "速度。メートル / 秒数で表す。" diff --git a/src/docs/api/entities/post.yaml b/src/docs/api/entities/post.yaml new file mode 100644 index 0000000000..6fd26543bb --- /dev/null +++ b/src/docs/api/entities/post.yaml @@ -0,0 +1,168 @@ +name: "Note" + +desc: + ja: "投稿。" + en: "A note." + +props: + - name: "id" + type: "id" + optional: false + desc: + ja: "投稿ID" + en: "The ID of this note" + - name: "createdAt" + type: "date" + optional: false + desc: + ja: "投稿日時" + en: "The posted date of this note" + - name: "viaMobile" + type: "boolean" + optional: true + desc: + ja: "モバイル端末から投稿したか否か(自己申告であることに留意)" + en: "Whether this note sent via a mobile device" + - name: "text" + type: "string" + optional: true + desc: + ja: "投稿の本文 (ローカルの場合Markdown風のフォーマット)" + en: "The text of this note (in Markdown like format if local)" + - name: "mediaIds" + type: "id(DriveFile)[]" + optional: true + desc: + ja: "添付されているメディアのID (なければレスポンスでは空配列)" + en: "The IDs of the attached media (empty array for response if no media is attached)" + - name: "media" + type: "entity(DriveFile)[]" + optional: true + desc: + ja: "添付されているメディア" + en: "The attached media" + - name: "userId" + type: "id(User)" + optional: false + desc: + ja: "投稿者ID" + en: "The ID of author of this note" + - name: "user" + type: "entity(User)" + optional: true + desc: + ja: "投稿者" + en: "The author of this note" + - name: "myReaction" + type: "string" + optional: true + desc: + ja: "この投稿に対する自分のリアクション" + en: "The your reaction of this note" + - name: "reactionCounts" + type: "object" + optional: false + desc: + ja: "リアクションをキーとし、この投稿に対するそのリアクションの数を値としたオブジェクト" + - name: "replyId" + type: "id(Note)" + optional: true + desc: + ja: "返信した投稿のID" + en: "The ID of the replyed note" + - name: "reply" + type: "entity(Note)" + optional: true + desc: + ja: "返信した投稿" + en: "The replyed note" + - name: "renoteId" + type: "id(Note)" + optional: true + desc: + ja: "引用した投稿のID" + en: "The ID of the quoted note" + - name: "renote" + type: "entity(Note)" + optional: true + desc: + ja: "引用した投稿" + en: "The quoted note" + - name: "poll" + type: "object" + optional: true + desc: + ja: "投票" + en: "The poll" + defName: "poll" + def: + - name: "choices" + type: "object[]" + optional: false + desc: + ja: "投票の選択肢" + en: "The choices of this poll" + defName: "choice" + def: + - name: "id" + type: "number" + optional: false + desc: + ja: "選択肢ID" + en: "The ID of this choice" + - name: "isVoted" + type: "boolean" + optional: true + desc: + ja: "自分がこの選択肢に投票したかどうか" + en: "Whether you voted to this choice" + - name: "text" + type: "string" + optional: false + desc: + ja: "選択肢本文" + en: "The text of this choice" + - name: "votes" + type: "number" + optional: false + desc: + ja: "この選択肢に投票された数" + en: "The number voted for this choice" + - name: "geo" + type: "object" + optional: true + desc: + ja: "位置情報" + en: "Geo location" + defName: "geo" + def: + - name: "coordinates" + type: "number[]" + optional: false + desc: + ja: "座標。最初に経度:-180〜180で表す。最後に緯度:-90〜90で表す。" + - name: "altitude" + type: "number" + optional: false + desc: + ja: "高度。メートル単位で表す。" + - name: "accuracy" + type: "number" + optional: false + desc: + ja: "緯度、経度の精度。メートル単位で表す。" + - name: "altitudeAccuracy" + type: "number" + optional: false + desc: + ja: "高度の精度。メートル単位で表す。" + - name: "heading" + type: "number" + optional: false + desc: + ja: "方角。0〜360の角度で表す。0が北、90が東、180が南、270が西。" + - name: "speed" + type: "number" + optional: false + desc: + ja: "速度。メートル / 秒数で表す。" diff --git a/src/docs/api/entities/style.styl b/src/docs/api/entities/style.styl new file mode 100644 index 0000000000..bddf0f53ab --- /dev/null +++ b/src/docs/api/entities/style.styl @@ -0,0 +1 @@ +@import "../style" diff --git a/src/docs/api/entities/user.yaml b/src/docs/api/entities/user.yaml new file mode 100644 index 0000000000..3328734d2b --- /dev/null +++ b/src/docs/api/entities/user.yaml @@ -0,0 +1,177 @@ +name: "User" + +desc: + ja: "ユーザー。" + en: "A user." + +props: + id: + type: "id" + optional: false + desc: + ja: "ユーザーID" + en: "The ID of this user" + + createdAt: + type: "date" + optional: false + desc: + ja: "アカウント作成日時" + en: "The registered date of this user" + + username: + type: "string" + optional: false + desc: + ja: "ユーザー名" + en: "The username of this user" + + description: + type: "string" + optional: false + desc: + ja: "アカウントの説明(自己紹介)" + en: "The description of this user" + + avatarId: + type: "id(DriveFile)" + optional: true + desc: + ja: "アバターのID" + en: "The ID of the avatar of this user" + + avatarUrl: + type: "string" + optional: false + desc: + ja: "アバターのURL" + en: "The URL of the avatar of this user" + + bannerId: + type: "id(DriveFile)" + optional: true + desc: + ja: "バナーのID" + en: "The ID of the banner of this user" + + bannerUrl: + type: "string" + optional: false + desc: + ja: "バナーのURL" + en: "The URL of the banner of this user" + + followersCount: + type: "number" + optional: false + desc: + ja: "フォロワーの数" + en: "The number of the followers for this user" + + followingCount: + type: "number" + optional: false + desc: + ja: "フォローしているユーザーの数" + en: "The number of the following users for this user" + + isFollowing: + type: "boolean" + optional: true + desc: + ja: "自分がこのユーザーをフォローしているか" + + isFollowed: + type: "boolean" + optional: true + desc: + ja: "自分がこのユーザーにフォローされているか" + + isMuted: + type: "boolean" + optional: true + desc: + ja: "自分がこのユーザーをミュートしているか" + en: "Whether you muted this user" + + notesCount: + type: "number" + optional: false + desc: + ja: "投稿の数" + en: "The number of the notes of this user" + + pinnedNote: + type: "entity(Note)" + optional: true + desc: + ja: "ピン留めされた投稿" + en: "The pinned note of this user" + + pinnedNoteId: + type: "id(Note)" + optional: true + desc: + ja: "ピン留めされた投稿のID" + en: "The ID of the pinned note of this user" + + driveCapacity: + type: "number" + optional: false + desc: + ja: "ドライブの容量(bytes)" + en: "The capacity of drive of this user (bytes)" + + host: + type: "string | null" + optional: false + desc: + ja: "ホスト (例: example.com:3000)" + en: "Host (e.g. example.com:3000)" + + twitter: + type: "object" + optional: true + desc: + ja: "連携されているTwitterアカウント情報" + en: "The info of the connected twitter account of this user" + props: + userId: + type: "string" + optional: false + desc: + ja: "ユーザーID" + en: "The user ID" + screenName: + type: "string" + optional: false + desc: + ja: "ユーザー名" + en: "The screen name of this user" + + isBot: + type: "boolean" + optional: true + desc: + ja: "botか否か(自己申告であることに留意)" + en: "Whether is bot or not" + + profile: + type: "object" + optional: false + desc: + ja: "プロフィール" + en: "The profile of this user" + props: + location: + type: "string" + optional: true + desc: + ja: "場所" + en: "The location of this user" + birthday: + type: "string" + optional: true + desc: + ja: "誕生日 (YYYY-MM-DD)" + en: "The birthday of this user (YYYY-MM-DD)" diff --git a/src/docs/api/entities/view.pug b/src/docs/api/entities/view.pug new file mode 100644 index 0000000000..3f50bfd3bd --- /dev/null +++ b/src/docs/api/entities/view.pug @@ -0,0 +1,20 @@ +extends ../../layout.pug +include ../mixins + +block meta + link(rel="stylesheet" href="/docs/assets/api/entities/style.css") + +block main + h1= name + + p#desc= desc[lang] || desc['ja'] + + section + h2= i18n('docs.api.entities.properties') + +propTable(props) + + if propDefs + each propDef in propDefs + section(id= propDef.name) + h3= propDef.name + +propTable(propDef.props) diff --git a/src/docs/api/mixins.pug b/src/docs/api/mixins.pug new file mode 100644 index 0000000000..9e03abefeb --- /dev/null +++ b/src/docs/api/mixins.pug @@ -0,0 +1,31 @@ +mixin propTable(props) + table.props + thead: tr + th= i18n('docs.api.props.name') + th= i18n('docs.api.props.type') + th= i18n('docs.api.props.description') + tbody + each prop in props + tr + td.name= prop.name + td.type + i= prop.type + if prop.kind == 'id' + if prop.entity + | ( + a(href=`/docs/${lang}/api/entities/${kebab(prop.entity)}`)= prop.entity + | ID) + else + | (ID) + else if prop.kind == 'entity' + | ( + a(href=`/docs/${lang}/api/entities/${kebab(prop.entity)}`)= prop.entity + | ) + else if prop.kind == 'object' + if prop.hasDef + | ( + a(href=`#${prop.name}`)= prop.name + | ) + else if prop.kind == 'date' + | (Date) + td.desc!= prop.desc ? prop.desc[lang] || prop.desc['ja'] : null diff --git a/src/docs/api/style.styl b/src/docs/api/style.styl new file mode 100644 index 0000000000..3675a4da6f --- /dev/null +++ b/src/docs/api/style.styl @@ -0,0 +1,11 @@ +@import "../style" + +table.props + .name + font-weight bold + + .name + .type + .optional + font-family Consolas, 'Courier New', Courier, Monaco, monospace + diff --git a/src/docs/article.pug b/src/docs/article.pug new file mode 100644 index 0000000000..fe68ceb910 --- /dev/null +++ b/src/docs/article.pug @@ -0,0 +1,4 @@ +extends ./layout.pug + +block main + != html diff --git a/src/docs/layout.pug b/src/docs/layout.pug new file mode 100644 index 0000000000..4186d2d365 --- /dev/null +++ b/src/docs/layout.pug @@ -0,0 +1,41 @@ +doctype html + +html(lang= lang) + head + meta(charset="UTF-8") + meta(name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no") + title + | #{title} | Misskey Docs + link(rel="stylesheet" href="/docs/assets/style.css") + block meta + + //- FontAwesome style + style #{facss} + + body + nav + ul + each doc in docs + li: a(href=`/docs/${lang}/${doc.name}`)= doc.title[lang] || doc.title['ja'] + section + h2 API + ul + li Entities + ul + each entity in entities + li: a(href=`/docs/${lang}/api/entities/${kebab(entity)}`)= entity + li Endpoints + ul + each endpoint in endpoints + li: a(href=`/docs/${lang}/api/endpoints/${kebab(endpoint)}`)= endpoint + main + article + block main + if content + | !{content} + + footer + p + | %i18n:docs.edit-this-page-on-github% + a(href=src target="_blank") %i18n:docs.edit-this-page-on-github-link% + small= copyright diff --git a/src/docs/style.styl b/src/docs/style.styl new file mode 100644 index 0000000000..d9ee9dad4a --- /dev/null +++ b/src/docs/style.styl @@ -0,0 +1,120 @@ +@import "../client/style" +@import "./ui" + +body + margin 0 + color #34495e + word-break break-word + +main + margin 0 0 0 256px + padding 64px + width 100% + max-width 800px + + section + margin 32px 0 + + h1 + margin 0 0 24px 0 + padding 16px 0 + font-size 1.5em + border-bottom solid 2px #eee + + h2 + margin 0 0 24px 0 + padding 0 0 16px 0 + font-size 1.4em + border-bottom solid 1px #eee + + h3 + margin 0 + padding 0 + font-size 1.25em + + h4 + margin 0 + + p + margin 1em 0 + line-height 1.6em + + footer + margin 32px 0 0 0 + border-top solid 2px #eee + + > small + margin 16px 0 0 0 + color #aaa + +nav + display block + position fixed + z-index 10000 + top 0 + left 0 + width 256px + height 100% + overflow auto + padding 32px + background #fff + border-right solid 2px #eee + +@media (max-width 1025px) + main + margin 0 + max-width 100% + + nav + position relative + width 100% + max-height 128px + background #f9f9f9 + border-right none + +@media (max-width 768px) + main + padding 32px + +@media (max-width 512px) + main + padding 16px + +table + display block + width 100% + max-width 100% + overflow auto + border-spacing 0 + border-collapse collapse + + thead + font-weight bold + border-bottom solid 2px #eee + + tr + th + text-align left + + tbody + tr + &:nth-child(odd) + background #fbfbfb + + th, td + padding 8px 16px + min-width 128px + +code + display inline-block + padding 8px 10px + font-family Consolas, 'Courier New', Courier, Monaco, monospace + color #295c92 + background #f2f2f2 + border-radius 4px + +pre + overflow auto + + > code + display block diff --git a/src/docs/ui.styl b/src/docs/ui.styl new file mode 100644 index 0000000000..8d5515712f --- /dev/null +++ b/src/docs/ui.styl @@ -0,0 +1,19 @@ +.ui.info + display block + margin 1em 0 + padding 0 1em + font-size 90% + color rgba(#000, 0.87) + background #f8f8f9 + border-radius 4px + overflow hidden + + > p + opacity 0.8 + + > [data-fa]:first-child + margin-right 0.25em + + &.warn + color #573a08 + background #FFFAF3 diff --git a/src/server/web/docs.ts b/src/server/web/docs.ts index f4d6be885b..8f707d4d3f 100644 --- a/src/server/web/docs.ts +++ b/src/server/web/docs.ts @@ -4,6 +4,7 @@ import * as fs from 'fs'; import * as path from 'path'; +import * as showdown from 'showdown'; import ms = require('ms'); import * as Router from 'koa-router'; import * as send from 'koa-send'; @@ -16,8 +17,6 @@ import { fa } from '../../misc/fa'; import { licenseHtml } from '../../misc/license'; const constants = require('../../const.json'); -const docs = `${__dirname}/../../client/docs/`; - async function genVars(lang: string): Promise<{ [key: string]: any }> { const vars = {} as { [key: string]: any }; @@ -26,23 +25,23 @@ async function genVars(lang: string): Promise<{ [key: string]: any }> { const endpoints = glob.sync('./built/server/api/endpoints/**/*.js'); vars['endpoints'] = endpoints.map(ep => require('../../../' + ep)).filter(x => x.meta).map(x => x.meta.name); - const entities = glob.sync('./src/client/docs/api/entities/**/*.yaml'); + const entities = glob.sync('./src/docs/api/entities/**/*.yaml'); vars['entities'] = entities.map(x => { const _x = yaml.safeLoad(fs.readFileSync(x, 'utf-8')) as any; return _x.name; }); - const docs = glob.sync('./src/client/docs/**/*.*.pug'); + const docs = glob.sync('./src/docs/**/*.md'); vars['docs'] = {}; docs.forEach(x => { - const [, name, lang] = x.match(/docs\/(.+?)\.(.+?)\.pug$/); + const [, name, lang] = x.match(/docs\/(.+?)\.(.+?)\.md$/); if (vars['docs'][name] == null) { vars['docs'][name] = { name, title: {} }; } - vars['docs'][name]['title'][lang] = fs.readFileSync(x, 'utf-8').match(/^h1 (.+?)\r?\n/)[1]; + vars['docs'][name]['title'][lang] = fs.readFileSync(x, 'utf-8').match(/^# (.+?)\r?\n/)[1]; }); vars['kebab'] = (string: string) => string.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\s+/g, '-').toLowerCase(); @@ -162,7 +161,7 @@ const router = new Router(); router.get('/assets/*', async ctx => { await send(ctx, ctx.params[0], { - root: docs + '/assets/', + root: `${__dirname}/../../docs/assets/`, maxage: ms('7 days'), immutable: true }); @@ -183,20 +182,20 @@ router.get('/*/api/endpoints/*', async ctx => { // @ts-ignore params: sortParams(Object.entries(ep.params).map(([k, v]) => parseParamDefinition(k, v))), paramDefs: extractParamDefRef(Object.entries(ep.params).map(([k, v]) => v)), - res: ep.res.props ? sortParams(Object.entries(ep.res.props).map(([k, v]) => parsePropDefinition(k, v))) : null, + res: ep.res && ep.res.props ? sortParams(Object.entries(ep.res.props).map(([k, v]) => parsePropDefinition(k, v))) : null, resDefs: null//extractPropDefRef(Object.entries(ep.res.props).map(([k, v]) => parsePropDefinition(k, v))) }; - await ctx.render('../../../../src/client/docs/api/endpoints/view', Object.assign(await genVars(lang), vars)); + await ctx.render('../../../../src/docs/api/endpoints/view', Object.assign(await genVars(lang), vars)); }); router.get('/*/api/entities/*', async ctx => { const lang = ctx.params[0]; const entity = ctx.params[1]; - const x = yaml.safeLoad(fs.readFileSync(path.resolve('./src/client/docs/api/entities/' + entity + '.yaml'), 'utf-8')) as any; + const x = yaml.safeLoad(fs.readFileSync(path.resolve('./src/docs/api/entities/' + entity + '.yaml'), 'utf-8')) as any; - await ctx.render('../../../../src/client/docs/api/entities/view', Object.assign(await genVars(lang), { + await ctx.render('../../../../src/docs/api/entities/view', Object.assign(await genVars(lang), { name: x.name, desc: x.desc, props: sortParams(Object.entries(x.props).map(([k, v]) => parsePropDefinition(k, v))), @@ -208,7 +207,12 @@ router.get('/*/*', async ctx => { const lang = ctx.params[0]; const doc = ctx.params[1]; - await ctx.render('../../../../src/client/docs/' + doc + '.' + lang, await genVars(lang)); + const conv = new showdown.Converter(); + const md = fs.readFileSync(`${__dirname}/../../../src/docs/${doc}.${lang}.md`, 'utf8'); + + await ctx.render('../../../../src/docs/article', Object.assign({ + html: conv.makeHtml(md) + }, await genVars(lang))); }); export default router; -- cgit v1.2.3-freya