mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-03 23:14:13 +00:00 
			
		
		
		
	aboutのドキュメント(pug)を予めコンパイルしておくように
This commit is contained in:
		
							parent
							
								
									3043f81321
								
							
						
					
					
						commit
						7fcbbed901
					
				
					 5 changed files with 35 additions and 23 deletions
				
			
		
							
								
								
									
										37
									
								
								gulpfile.ts
									
										
									
									
									
								
							
							
						
						
									
										37
									
								
								gulpfile.ts
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2,6 +2,7 @@
 | 
			
		|||
 * Gulp tasks
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
import * as path from 'path';
 | 
			
		||||
import * as gulp from 'gulp';
 | 
			
		||||
import * as gutil from 'gulp-util';
 | 
			
		||||
import * as babel from 'gulp-babel';
 | 
			
		||||
| 
						 | 
				
			
			@ -36,6 +37,7 @@ const tsProject = ts.createProject('tsconfig.json');
 | 
			
		|||
gulp.task('build', [
 | 
			
		||||
	'build:js',
 | 
			
		||||
	'build:ts',
 | 
			
		||||
	'build:pug',
 | 
			
		||||
	'build:copy',
 | 
			
		||||
	'build:client'
 | 
			
		||||
]);
 | 
			
		||||
| 
						 | 
				
			
			@ -60,16 +62,35 @@ gulp.task('build:ts', () =>
 | 
			
		|||
		.pipe(gulp.dest('./built/'))
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
gulp.task('build:copy', () => {
 | 
			
		||||
	gulp.src([
 | 
			
		||||
		'./src/**/resources/**/*',
 | 
			
		||||
		'!./src/web/app/**/resources/**/*'
 | 
			
		||||
	]).pipe(gulp.dest('./built/'));
 | 
			
		||||
	gulp.src([
 | 
			
		||||
		'./src/web/about/**/*'
 | 
			
		||||
	]).pipe(gulp.dest('./built/web/about/'));
 | 
			
		||||
gulp.task('build:pug', () => {
 | 
			
		||||
	const pugs = glob.sync('./src/web/about/pages/**/*.pug');
 | 
			
		||||
	const streams = pugs.map(file => {
 | 
			
		||||
		const page = file.replace('./src/web/about/pages/', '').replace('.pug', '');
 | 
			
		||||
		return gulp.src(file)
 | 
			
		||||
			.pipe(pug({
 | 
			
		||||
				locals: Object.assign({
 | 
			
		||||
					path: page
 | 
			
		||||
				}, config)
 | 
			
		||||
			}))
 | 
			
		||||
			.pipe(gulp.dest('./built/web/about/pages/' + path.parse(page).dir));
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	return es.merge.apply(es, streams);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
gulp.task('build:copy', () =>
 | 
			
		||||
	es.merge(
 | 
			
		||||
		gulp.src([
 | 
			
		||||
			'./src/**/resources/**/*',
 | 
			
		||||
			'!./src/web/app/**/resources/**/*'
 | 
			
		||||
		]).pipe(gulp.dest('./built/')),
 | 
			
		||||
		gulp.src([
 | 
			
		||||
			'./src/web/about/**/*',
 | 
			
		||||
			'!./src/web/about/**/*.pug'
 | 
			
		||||
		]).pipe(gulp.dest('./built/web/about/'))
 | 
			
		||||
	)
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
gulp.task('test', ['lint', 'build']);
 | 
			
		||||
 | 
			
		||||
gulp.task('lint', () =>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ html(lang='ja', dir='ltr')
 | 
			
		|||
	head
 | 
			
		||||
		meta(charset='utf-8')
 | 
			
		||||
		meta(name='application-name', content='Misskey')
 | 
			
		||||
		meta(name='theme-color', content='#f76d6c')
 | 
			
		||||
		meta(name='theme-color', content=themeColor)
 | 
			
		||||
		meta(name='referrer', content='origin')
 | 
			
		||||
		meta(name='viewport', content='width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no')
 | 
			
		||||
		link(rel='stylesheet', href='/resources/style.css')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,7 +29,7 @@ block content
 | 
			
		|||
			h3 アプリケーションを作成する
 | 
			
		||||
			p まずはあなたのアプリケーションを作成しましょう。
 | 
			
		||||
			p
 | 
			
		||||
				| <a href=#{config.dev_url} target="_blank">デベロッパーセンター</a>にアクセスし、アプリ > アプリ作成 に進みます。
 | 
			
		||||
				| <a href=#{dev_url} target="_blank">デベロッパーセンター</a>にアクセスし、アプリ > アプリ作成 に進みます。
 | 
			
		||||
				br
 | 
			
		||||
				| 次に、フォームに必要事項を記入します:
 | 
			
		||||
			dl
 | 
			
		||||
| 
						 | 
				
			
			@ -55,7 +55,7 @@ block content
 | 
			
		|||
		section
 | 
			
		||||
			h3 ユーザーに認証させる
 | 
			
		||||
			p あなたのアプリを使ってもらうには、ユーザーにアカウントへアクセスすることを許可してもらい、Misskeyにそのユーザーのアクセストークンを発行してもらう必要があります。
 | 
			
		||||
			p 認証セッションを開始するには、<code>#{config.api_url}/auth/session/generate</code>へパラメータに<code>app_secret</code>としてApp Secretを含めたリクエストを送信します。
 | 
			
		||||
			p 認証セッションを開始するには、<code>#{api_url}/auth/session/generate</code>へパラメータに<code>app_secret</code>としてApp Secretを含めたリクエストを送信します。
 | 
			
		||||
			p
 | 
			
		||||
				| そうすると、レスポンスとして認証セッションのトークンや認証フォームのURLが取得できます。
 | 
			
		||||
				br
 | 
			
		||||
| 
						 | 
				
			
			@ -67,7 +67,7 @@ block content
 | 
			
		|||
				h4 あなたのアプリがコールバックURLを設定していない場合
 | 
			
		||||
				p ユーザーがアプリの連携を許可したことを(何らかの方法で(たとえばボタンを押させるなど))確認出来るようにしてください。
 | 
			
		||||
			p
 | 
			
		||||
				| 次に、<code>#{config.api_url}/auth/session/userkey</code>へ<code>app_secret</code>としてApp Secretを、<code>token</code>としてセッションのトークンをパラメータとして付与したリクエストを送信してください。
 | 
			
		||||
				| 次に、<code>#{api_url}/auth/session/userkey</code>へ<code>app_secret</code>としてApp Secretを、<code>token</code>としてセッションのトークンをパラメータとして付与したリクエストを送信してください。
 | 
			
		||||
				br
 | 
			
		||||
				| 上手くいけば、認証したユーザーのアクセストークンがレスポンスとして取得できます。おめでとうございます!
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,5 +5,3 @@ block title
 | 
			
		|||
 | 
			
		||||
block content
 | 
			
		||||
	h1 ライセンス
 | 
			
		||||
 | 
			
		||||
	include ../../../../LICENSE
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,6 @@ import serveApp from './serve-app';
 | 
			
		|||
 */
 | 
			
		||||
const app = express();
 | 
			
		||||
app.disable('x-powered-by');
 | 
			
		||||
app.set('view engine', 'pug');
 | 
			
		||||
 | 
			
		||||
app.use(bodyParser.urlencoded({ extended: true }));
 | 
			
		||||
app.use(compression());
 | 
			
		||||
| 
						 | 
				
			
			@ -64,17 +63,11 @@ app.use('/@/about/resources', express.static(`${__dirname}/about/resources`, {
 | 
			
		|||
}));
 | 
			
		||||
 | 
			
		||||
app.get('/@/about/', (req, res) => {
 | 
			
		||||
	res.render(`${__dirname}/about/pages/index`, {
 | 
			
		||||
		path: 'index',
 | 
			
		||||
		config: config
 | 
			
		||||
	});
 | 
			
		||||
	res.sendFile(`${__dirname}/about/pages/index.html`);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
app.get('/@/about/:page(*)', (req, res) => {
 | 
			
		||||
	res.render(`${__dirname}/about/pages/${req.params.page}`, {
 | 
			
		||||
		path: req.params.page,
 | 
			
		||||
		config: config
 | 
			
		||||
	});
 | 
			
		||||
	res.sendFile(`${__dirname}/about/pages/${req.params.page}.html`);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
app.get('/@/auth/*', serveApp('auth')); // authorize form
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue