From c285a017c3a36d3aa65548bfa9299804e7c69aed Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Thu, 9 Feb 2023 22:20:58 +0800 Subject: [PATCH] Increase view.html iframe height --- packages/api/src/utils/parser.ts | 6 +- .../readabilityjs/test/test-pages/view.html | 520 -------- packages/readabilityjs/test/view.html | 1114 +++++++++++++++++ .../test/{test-pages => }/view.py | 9 +- 4 files changed, 1123 insertions(+), 526 deletions(-) delete mode 100644 packages/readabilityjs/test/test-pages/view.html create mode 100644 packages/readabilityjs/test/view.html rename packages/readabilityjs/test/{test-pages => }/view.py (64%) diff --git a/packages/api/src/utils/parser.ts b/packages/api/src/utils/parser.ts index 7bfac8809..93c9eaffc 100644 --- a/packages/api/src/utils/parser.ts +++ b/packages/api/src/utils/parser.ts @@ -23,6 +23,7 @@ import { import { NodeHtmlMarkdown } from 'node-html-markdown' import { promisify } from 'util' import * as jwt from 'jsonwebtoken' +import { env } from '../env' const logger = buildLogger('utils.parse') const signToken = promisify(jwt.sign) @@ -500,12 +501,13 @@ export const getDistillerResult = async ( return undefined } - const token = await signToken({ uid }, '1h') + const exp = Math.floor(Date.now() / 1000) + 60 * 60 // 1 hour + const auth = (await signToken({ uid, exp }, env.server.jwtSecret)) as string console.debug('Parsing by distiller', url) const response = await axios.post(url, html, { headers: { - Authorization: token as string, + Authorization: auth, }, timeout: 5000, }) diff --git a/packages/readabilityjs/test/test-pages/view.html b/packages/readabilityjs/test/test-pages/view.html deleted file mode 100644 index c4a2a61e4..000000000 --- a/packages/readabilityjs/test/test-pages/view.html +++ /dev/null @@ -1,520 +0,0 @@ - - - - - - - - - - - - - - - - -
- - - -
- - - - diff --git a/packages/readabilityjs/test/view.html b/packages/readabilityjs/test/view.html new file mode 100644 index 000000000..6575cc16a --- /dev/null +++ b/packages/readabilityjs/test/view.html @@ -0,0 +1,1114 @@ + + + + + + + + + + + + + +
+ + + +
+ + diff --git a/packages/readabilityjs/test/test-pages/view.py b/packages/readabilityjs/test/view.py similarity index 64% rename from packages/readabilityjs/test/test-pages/view.py rename to packages/readabilityjs/test/view.py index 5f0c77601..c8bd7bf2a 100644 --- a/packages/readabilityjs/test/test-pages/view.py +++ b/packages/readabilityjs/test/view.py @@ -3,7 +3,8 @@ from os import listdir from os.path import isfile, join -testdirs = [f for f in listdir(".") if not isfile(join(".", f))] +testdirs = [f for f in listdir( + "test-pages") if not isfile(join("test-pages", f))] print(""" @@ -25,9 +26,9 @@ print(""" for testdir in testdirs: print(f"""
  • {testdir}
    - [source] - [readability] - [dom-distiller] + [source] + [readability] + [dom-distiller]
  • """)