增加自定义脚本名字长度

pull/733/head
lyswhut 2021-10-07 10:22:30 +08:00
parent 001eba6729
commit 68518e609d
2 changed files with 3 additions and 2 deletions

View File

@ -66,6 +66,7 @@ const handleRequest = (context, { requestKey, data }) => {
*
* @param {*} context
* @param {*} info {
* openDevTools: false,
* status: true,
* message: 'xxx',
* sources: {

View File

@ -19,9 +19,9 @@ exports.importApi = script => {
let name = scriptInfo[1] || ''
let description = scriptInfo[2] || ''
name = name.startsWith(' * @name ') ? name.replace(' * @name ', '').trim() : `user_api_${new Date().toLocaleString()}`
if (name.length > 10) name = name.substring(0, 10) + '...'
if (name.length > 24) name = name.substring(0, 24) + '...'
description = description.startsWith(' * @description ') ? description.replace(' * @description ', '').trim() : ''
if (description.length > 20) description = description.substring(0, 20) + '...'
if (description.length > 36) description = description.substring(0, 36) + '...'
const apiInfo = {
id: `user_api_${Math.random().toString().substring(2, 5)}_${Date.now()}`,
name,