Rename endpoints for websearch

This commit is contained in:
Cohee 2024-06-19 22:37:51 +03:00
parent 75dfe87054
commit 8d5876c2c8
3 changed files with 10 additions and 5 deletions

View File

@ -185,7 +185,7 @@ class WebScraper {
const files = [];
for (const link of links) {
const result = await fetch('/api/serpapi/visit', {
const result = await fetch('/api/search/visit', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ url: link }),
@ -530,7 +530,7 @@ class YouTubeScraper {
async getScript(videoUrl, lang) {
const id = this.parseId(String(videoUrl).trim());
const result = await fetch('/api/serpapi/transcript', {
const result = await fetch('/api/search/transcript', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ id, lang }),

View File

@ -404,6 +404,11 @@ redirect('/api/content/import', '/api/content/importURL');
// Redirect deprecated moving UI endpoints
redirect('/savemovingui', '/api/moving-ui/save');
// Redirect Serp endpoints
redirect('/api/serpapi/search', '/api/search/serpapi');
redirect('/api/serpapi/visit', '/api/search/visit');
redirect('/api/serpapi/transcript', '/api/search/transcript');
// Moving UI
app.use('/api/moving-ui', require('./src/endpoints/moving-ui').router);
@ -499,8 +504,8 @@ app.use('/api/extra/classify', require('./src/endpoints/classify').router);
// Image captioning
app.use('/api/extra/caption', require('./src/endpoints/caption').router);
// Web search extension
app.use('/api/serpapi', require('./src/endpoints/serpapi').router);
// Web search and scraping
app.use('/api/search', require('./src/endpoints/search').router);
// The different text generation APIs

View File

@ -22,7 +22,7 @@ const visitHeaders = {
'Sec-Fetch-User': '?1',
};
router.post('/search', jsonParser, async (request, response) => {
router.post('/serpapi', jsonParser, async (request, response) => {
try {
const key = readSecret(request.user.directories, SECRET_KEYS.SERPAPI);