code: update drawLink

This commit is contained in:
ShawnPhang 2023-09-04 14:11:11 +08:00
parent 9cb2dde54b
commit e1dcbb49b2
2 changed files with 9 additions and 7 deletions

View File

@ -3,7 +3,7 @@
* @Date: 2022-02-01 13:41:59
* @Description:
* @LastEditors: ShawnPhang <site: book.palxp.com>
* @LastEditTime: 2023-07-06 14:53:05
* @LastEditTime: 2023-09-04 14:09:51
*/
const isDev = process.env.NODE_ENV === 'development'
@ -14,6 +14,11 @@ exports.servicePort = 7001
*/
exports.executablePath = '/opt/google/chrome-unstable/chrome',
/**
*
*/
exports.drawLink = isDev ? 'http://localhost:3000/draw' : 'https://design.palxp.com/draw'
/**
*
*/

View File

@ -3,11 +3,11 @@
* @Date: 2020-07-22 20:13:14
* @Description:
* @LastEditors: ShawnPhang <site: book.palxp.com>
* @LastEditTime: 2023-09-04 10:54:52
* @LastEditTime: 2023-09-04 14:08:10
*/
const { saveScreenshot } = require('../utils/download-single.ts')
const uuid = require('../utils/uuid.ts')
const { filePath, upperLimit } = require('../configs.ts')
const { filePath, upperLimit, drawLink } = require('../configs.ts')
const { queueRun, queueList } = require('../utils/node-queue.ts')
// const path = require('path')
const fs = require('fs')
@ -55,11 +55,8 @@ module.exports = {
* @apiParam {String} size ,
* @apiParam {String} quality ,
*/
const isDev = process.env.NODE_ENV === 'development'
let { id, tempid, width, height, screenshot_url, type = 'file', size, quality } = req.query
const defaultUrl = isDev ? 'http://localhost:3000/draw' : 'https://design.palxp.com/draw'
const url = (screenshot_url || defaultUrl) + `${id ? '?id=' : '?tempid='}`
const url = (screenshot_url || drawLink) + `${id ? '?id=' : '?tempid='}`
id = id || tempid
const path = filePath + `${id}-screenshot.png`
const thumbPath = type === 'cover' ? filePath + `${id}-cover.jpg` : null