diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-12-17 14:35:30 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-12-17 14:35:30 +0900 |
| commit | d4fb399c95c65e4a6805e02074b8e5cc754a3822 (patch) | |
| tree | 4901d6b8828aada8275feb4787fcede57eb0bd27 /src/web/docs | |
| parent | Update api.ja.pug (diff) | |
| download | sharkey-d4fb399c95c65e4a6805e02074b8e5cc754a3822.tar.gz sharkey-d4fb399c95c65e4a6805e02074b8e5cc754a3822.tar.bz2 sharkey-d4fb399c95c65e4a6805e02074b8e5cc754a3822.zip | |
なんかもうめっちゃ変えた
Diffstat (limited to 'src/web/docs')
| -rw-r--r-- | src/web/docs/api.ja.pug | 10 | ||||
| -rw-r--r-- | src/web/docs/api/endpoints/view.pug | 4 | ||||
| -rw-r--r-- | src/web/docs/api/entities/view.pug | 2 | ||||
| -rw-r--r-- | src/web/docs/api/gulpfile.ts | 11 | ||||
| -rw-r--r-- | src/web/docs/api/mixins.pug | 12 | ||||
| -rw-r--r-- | src/web/docs/gulpfile.ts | 8 | ||||
| -rw-r--r-- | src/web/docs/layout.pug | 7 | ||||
| -rw-r--r-- | src/web/docs/style.styl | 1 | ||||
| -rw-r--r-- | src/web/docs/ui.styl | 19 | ||||
| -rw-r--r-- | src/web/docs/vars.ts | 7 |
10 files changed, 58 insertions, 23 deletions
diff --git a/src/web/docs/api.ja.pug b/src/web/docs/api.ja.pug index 5514a40975..2584b08581 100644 --- a/src/web/docs/api.ja.pug +++ b/src/web/docs/api.ja.pug @@ -7,6 +7,7 @@ section h2 自分の所有するアカウントからAPIにアクセスする場合 p 「設定 > API」で、APIにアクセスするのに必要なAPIキーを取得してください。 p APIにアクセスする際には、リクエストにAPIキーを「i」というパラメータ名で含めます。 + div.ui.info.warn: p %fa:exclamation-triangle%アカウントを不正利用される可能性があるため、このトークンは第三者に教えないでください(アプリなどにも入力しないでください)。 p APIの詳しい使用法は「Misskey APIの利用」セクションをご覧ください。 section @@ -15,7 +16,7 @@ section | 直接ユーザーのAPIキーをアプリケーションが扱うのは危険なので、 | アプリケーションからAPIを利用する際には、アプリケーションとアプリケーションを利用するユーザーが結び付けられた専用のトークン(アクセストークン)をMisskeyに発行してもらい、 | そのトークンをリクエストのパラメータに含める必要があります。 - | (アクセストークンは、ユーザーが自分のアカウントにあなたのアプリケーションがアクセスすることを許可した場合のみ発行されます) + div.ui.info: p %fa:info-circle%アクセストークンは、ユーザーが自分のアカウントにあなたのアプリケーションがアクセスすることを許可した場合のみ発行されます p それでは、アクセストークンを取得するまでの流れを説明します。 @@ -46,9 +47,8 @@ section td 権限 td あなたのアプリケーションやWebサービスが要求する権限。ここで要求した機能だけがAPIからアクセスできます。 - p - | 登録が済むとアプリケーションのシークレットキーが入手できます。このシークレットキーは後で使用します。 - | アプリに成りすまされる可能性があるため、極力このシークレットキーは公開しないようにしてください。 + p 登録が済むとアプリケーションのシークレットキーが入手できます。このシークレットキーは後で使用します。 + div.ui.info.warn: p %fa:exclamation-triangle%アプリに成りすまされる可能性があるため、極力このシークレットキーは公開しないようにしてください。 section h3 2.ユーザーに認証させる @@ -93,7 +93,7 @@ section h2 Misskey APIの利用 p APIはすべてリクエストのパラメータ・レスポンスともにJSON形式です。また、すべてのエンドポイントはPOSTメソッドのみ受け付けます。 p APIリファレンスもご確認ください。 - + section h3 レートリミット p Misskey APIにはレートリミットがあり、短時間のうちに多数のリクエストを送信すると、一定時間APIを利用することができなくなることがあります。 diff --git a/src/web/docs/api/endpoints/view.pug b/src/web/docs/api/endpoints/view.pug index 90084ab276..d271a5517a 100644 --- a/src/web/docs/api/endpoints/view.pug +++ b/src/web/docs/api/endpoints/view.pug @@ -17,7 +17,7 @@ block main p#desc= desc[lang] || desc['ja'] section - h2= common.i18n[lang]['docs']['api']['endpoints']['params'] + h2 %i18n:docs.api.endpoints.params% +propTable(params) if paramDefs @@ -28,5 +28,5 @@ block main if res section - h2= common.i18n[lang]['docs']['api']['endpoints']['res'] + h2 %i18n:docs.api.endpoints.res% +propTable(res) diff --git a/src/web/docs/api/entities/view.pug b/src/web/docs/api/entities/view.pug index 99e786c694..2156463dc7 100644 --- a/src/web/docs/api/entities/view.pug +++ b/src/web/docs/api/entities/view.pug @@ -10,7 +10,7 @@ block main p#desc= desc[lang] || desc['ja'] section - h2= common.i18n[lang]['docs']['api']['entities']['properties'] + h2 %i18n:docs.api.entities.properties% +propTable(props) if propDefs diff --git a/src/web/docs/api/gulpfile.ts b/src/web/docs/api/gulpfile.ts index 2e8409c595..4c30871a0f 100644 --- a/src/web/docs/api/gulpfile.ts +++ b/src/web/docs/api/gulpfile.ts @@ -10,13 +10,16 @@ import * as pug from 'pug'; import * as yaml from 'js-yaml'; import * as mkdirp from 'mkdirp'; +import locales from '../../../../locales'; +import I18nReplacer from '../../../common/build/i18n'; +import fa from '../../../common/build/fa'; import config from './../../../conf'; import generateVars from '../vars'; const commonVars = generateVars(); -const langs = Object.keys(commonVars.i18n); +const langs = Object.keys(locales); const kebab = string => string.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\s+/g, '-').toLowerCase(); @@ -124,6 +127,9 @@ gulp.task('doc:api:endpoints', () => { console.error(renderErr); return; } + const i18n = new I18nReplacer(lang); + html = html.replace(i18n.pattern, i18n.replacement); + html = fa(html); const htmlPath = `./built/web/docs/${lang}/api/endpoints/${ep.endpoint}.html`; mkdirp(path.dirname(htmlPath), (mkdirErr) => { if (mkdirErr) { @@ -164,6 +170,9 @@ gulp.task('doc:api:entities', () => { console.error(renderErr); return; } + const i18n = new I18nReplacer(lang); + html = html.replace(i18n.pattern, i18n.replacement); + html = fa(html); const htmlPath = `./built/web/docs/${lang}/api/entities/${kebab(entity.name)}.html`; mkdirp(path.dirname(htmlPath), (mkdirErr) => { if (mkdirErr) { diff --git a/src/web/docs/api/mixins.pug b/src/web/docs/api/mixins.pug index b563a121db..686bf6a2b6 100644 --- a/src/web/docs/api/mixins.pug +++ b/src/web/docs/api/mixins.pug @@ -1,10 +1,10 @@ mixin propTable(props) table.props thead: tr - th= common.i18n[lang]['docs']['api']['props']['name'] - th= common.i18n[lang]['docs']['api']['props']['type'] - th= common.i18n[lang]['docs']['api']['props']['optional'] - th= common.i18n[lang]['docs']['api']['props']['description'] + th %i18n:docs.api.props.name% + th %i18n:docs.api.props.type% + th %i18n:docs.api.props.optional% + th %i18n:docs.api.props.description% tbody each prop in props tr @@ -31,7 +31,7 @@ mixin propTable(props) | (Date) td.optional if prop.optional - = common.i18n[lang]['docs']['api']['props']['yes'] + | %i18n:docs.api.props.yes% else - = common.i18n[lang]['docs']['api']['props']['no'] + | %i18n:docs.api.props.no% td.desc!= prop.desc[lang] || prop.desc['ja'] diff --git a/src/web/docs/gulpfile.ts b/src/web/docs/gulpfile.ts index 6668abdec6..71033e1bc7 100644 --- a/src/web/docs/gulpfile.ts +++ b/src/web/docs/gulpfile.ts @@ -7,13 +7,12 @@ import * as path from 'path'; import * as glob from 'glob'; import * as gulp from 'gulp'; import * as pug from 'pug'; -//import * as yaml from 'js-yaml'; import * as mkdirp from 'mkdirp'; import stylus = require('gulp-stylus'); import cssnano = require('gulp-cssnano'); -//import config from './../../conf'; - +import I18nReplacer from '../../common/build/i18n'; +import fa from '../../common/build/fa'; import generateVars from './vars'; require('./api/gulpfile.ts'); @@ -53,6 +52,9 @@ gulp.task('doc:docs', () => { console.error(renderErr2); return; } + const i18n = new I18nReplacer(lang); + html = html.replace(i18n.pattern, i18n.replacement); + html = fa(html); const htmlPath = `./built/web/docs/${lang}/${name}.html`; mkdirp(path.dirname(htmlPath), (mkdirErr) => { if (mkdirErr) { diff --git a/src/web/docs/layout.pug b/src/web/docs/layout.pug index ee8018ec63..9dfd0ab7af 100644 --- a/src/web/docs/layout.pug +++ b/src/web/docs/layout.pug @@ -9,6 +9,9 @@ html(lang= lang) link(rel="stylesheet" href="/assets/style.css") block meta + //- FontAwesome style + style #{common.facss} + body nav ul @@ -33,6 +36,6 @@ html(lang= lang) footer p - = common.i18n[lang]['docs']['edit-this-page-on-github'] - a(href=src target="_blank")= common.i18n[lang]['docs']['edit-this-page-on-github-link'] + | %i18n:docs.edit-this-page-on-github% + a(href=src target="_blank") %i18n:docs.edit-this-page-on-github-link% small= common.copyright diff --git a/src/web/docs/style.styl b/src/web/docs/style.styl index 32a2264f15..414be5c53d 100644 --- a/src/web/docs/style.styl +++ b/src/web/docs/style.styl @@ -1,4 +1,5 @@ @import "../style" +@import "./ui" body margin 0 diff --git a/src/web/docs/ui.styl b/src/web/docs/ui.styl new file mode 100644 index 0000000000..8d5515712f --- /dev/null +++ b/src/web/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/web/docs/vars.ts b/src/web/docs/vars.ts index da590d7bd9..65b224fbff 100644 --- a/src/web/docs/vars.ts +++ b/src/web/docs/vars.ts @@ -1,7 +1,8 @@ import * as fs from 'fs'; import * as glob from 'glob'; import * as yaml from 'js-yaml'; -import langs from '../../../locales'; + +import { fa } from '../../common/build/fa'; import config from '../../conf'; const constants = require('../../const.json'); @@ -37,9 +38,9 @@ export default function(): { [key: string]: any } { vars['config'] = config; - vars['i18n'] = langs; - vars['copyright'] = constants.copyright; + vars['facss'] = fa.dom.css(); + return vars; } |