1
+ import { Request , Response } from "express" ;
1
2
import * as fs from "fs" ;
2
3
import * as path from "path" ;
3
4
@@ -14,16 +15,15 @@ import {logger} from "../logger";
14
15
import { Note , Revision } from "../models" ;
15
16
import { errorInternalError , errorNotFound } from "../response" ;
16
17
17
-
18
- export function actionPublish ( req , res , note ) {
18
+ export function actionPublish ( req : Request , res : Response , note ) : void {
19
19
res . redirect ( config . serverURL + '/s/' + ( note . alias || note . shortid ) )
20
20
}
21
21
22
- export function actionSlide ( req , res , note ) {
22
+ export function actionSlide ( req : Request , res : Response , note ) : void {
23
23
res . redirect ( config . serverURL + '/p/' + ( note . alias || note . shortid ) )
24
24
}
25
25
26
- export function actionDownload ( req , res , note ) {
26
+ export function actionDownload ( req : Request , res : Response , note ) : void {
27
27
const body = note . content
28
28
const title = Note . decodeTitle ( note . title )
29
29
const filename = encodeURIComponent ( title )
@@ -39,7 +39,7 @@ export function actionDownload(req, res, note) {
39
39
res . send ( body )
40
40
}
41
41
42
- export function actionInfo ( req , res , note ) {
42
+ export function actionInfo ( req : Request , res : Response , note ) : void {
43
43
const body = note . content
44
44
const extracted = Note . extractMeta ( body )
45
45
const markdown = extracted . markdown
@@ -66,7 +66,7 @@ export function actionInfo(req, res, note) {
66
66
res . send ( data )
67
67
}
68
68
69
- export function actionPDF ( req , res , note ) {
69
+ export function actionPDF ( req : Request , res : Response , note ) : void {
70
70
const url = config . serverURL || 'http://' + req . get ( 'host' )
71
71
const body = note . content
72
72
const extracted = Note . extractMeta ( body )
@@ -119,7 +119,7 @@ const outputFormats = {
119
119
docx : 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
120
120
}
121
121
122
- export async function actionPandoc ( req , res , note ) {
122
+ export async function actionPandoc ( req : Request , res : Response , note ) : Promise < void > {
123
123
// var url = config.serverURL || 'http://' + req.get('host')
124
124
// var body = note.content
125
125
// var extracted = Note.extractMeta(body)
@@ -162,7 +162,7 @@ export async function actionPandoc(req, res, note) {
162
162
// }
163
163
}
164
164
165
- export function actionGist ( req , res , note ) {
165
+ export function actionGist ( req : Request , res : Response , note ) : void {
166
166
const data = {
167
167
client_id : config . github . clientID ,
168
168
redirect_uri : config . serverURL + '/auth/github/callback/' + Note . encodeNoteId ( note . id ) + '/gist' ,
@@ -173,7 +173,7 @@ export function actionGist(req, res, note) {
173
173
res . redirect ( 'https://github.com/login/oauth/authorize?' + query )
174
174
}
175
175
176
- export function actionRevision ( req , res , note ) {
176
+ export function actionRevision ( req : Request , res : Response , note ) : void {
177
177
const actionId = req . params . actionId
178
178
if ( actionId ) {
179
179
const time = moment ( parseInt ( actionId ) )
0 commit comments