@@ -1,4 +1,3 @@
|
||||
import { builtInSnippets } from './built-in'
|
||||
import { xLogPackSnippets } from './xlog'
|
||||
|
||||
export const allBuiltInSnippetPack = [...xLogPackSnippets, ...builtInSnippets]
|
||||
export const allBuiltInSnippetPack = [...builtInSnippets]
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { defineBuiltInSnippetConfig } from '../../function.types'
|
||||
|
||||
export default defineBuiltInSnippetConfig({
|
||||
name: 'getPageId',
|
||||
method: 'GET',
|
||||
code: `import axios from 'axios';
|
||||
|
||||
export default async function handler(ctx: Context) {
|
||||
const { req } = ctx
|
||||
const { query } = req
|
||||
const { slug, characterId } = query
|
||||
return axios.get('https://xlog.app/api/slug2id', {
|
||||
params: {
|
||||
slug, characterId
|
||||
},
|
||||
headers: {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:14.2) Gecko/20100101 Firefox/14.2.1"
|
||||
}
|
||||
}).then(data => data.data).catch(err => ({ err }))
|
||||
}`,
|
||||
path: 'get_page_id',
|
||||
reference: 'xlog',
|
||||
})
|
||||
@@ -1,20 +0,0 @@
|
||||
import { defineBuiltInSnippetConfig } from '../../function.types'
|
||||
|
||||
export default defineBuiltInSnippetConfig({
|
||||
name: 'getSummary',
|
||||
method: 'GET',
|
||||
code: `import axios from 'axios';
|
||||
|
||||
export default async function handler(ctx: Context) {
|
||||
const { req } = ctx
|
||||
const { query } = req
|
||||
const { cid, lang } = query
|
||||
return axios.get('https://xlog.app/api/summary', {
|
||||
params: {
|
||||
cid, lang: lang || 'zh-CN'
|
||||
}
|
||||
}).then(data => data.data).catch(err => ({ err }))
|
||||
}`,
|
||||
path: 'get_summary',
|
||||
reference: 'xlog',
|
||||
})
|
||||
@@ -1,4 +0,0 @@
|
||||
import get_page_id from './get_page_id'
|
||||
import get_summary from './get_summary'
|
||||
|
||||
export const xLogPackSnippets = [get_page_id, get_summary]
|
||||
Reference in New Issue
Block a user