11import { Hono } from 'hono' ;
2- import type { StorageAdapter } from '../storage/index.js' ;
3- import manifestSchema from '../schemas/manifest.js' ;
2+ import type { StorageAdapter } from '../../ storage/index.js' ;
3+ import manifestSchema from '../../ schemas/manifest.js' ;
44import { z } from 'zod' ;
55import * as JSZip from 'jszip' ;
6- import { prisma } from '../db.js' ;
7- import { computeChecksum } from '../utils/checksum.js' ;
8- import { updateTrendingStatus } from '../utils/trending.js' ;
9- import { getGitHubAvatarUrl } from '../utils/avatar.js' ;
10- import { fetchGitHubUser , getDisplayName } from '../utils/github.js' ;
11- import { getExtensionGitHubUrls , buildAssetUrl } from '../utils/repository.js' ;
12- import { parseIcon } from '../utils/icons.js' ;
13- import { getMimeType } from '../utils/mime.js' ;
14- import type { AppContext } from '../types/app.js' ;
15- import { slugify } from '../utils/slugify.js' ;
6+ import { prisma } from '../../ db.js' ;
7+ import { computeChecksum } from '../../ utils/checksum.js' ;
8+ import { updateTrendingStatus } from '../../ utils/trending.js' ;
9+ import { getGitHubAvatarUrl } from '../../ utils/avatar.js' ;
10+ import { fetchGitHubUser , getDisplayName } from '../../ utils/github.js' ;
11+ import { getExtensionGitHubUrls , buildAssetUrl } from '../../ utils/repository.js' ;
12+ import { parseIcon } from '../../ utils/icons.js' ;
13+ import { getMimeType } from '../../ utils/mime.js' ;
14+ import type { AppContext } from '../../ types/app.js' ;
15+ import { slugify } from '../../ utils/slugify.js' ;
1616
1717const app = new Hono < AppContext > ( ) ;
1818
@@ -111,7 +111,7 @@ async function formatExtensionResponse(
111111 } )
112112 ) ;
113113
114- const downloadUrl = `${ baseUrl } /extensions /${ authorHandle . toLowerCase ( ) } /${ extension . name } /download` ;
114+ const downloadUrl = `${ baseUrl } /store /${ authorHandle . toLowerCase ( ) } /${ extension . name } /download` ;
115115
116116 return {
117117 id : extension . id ,
@@ -457,7 +457,7 @@ app.post('/extension/upload', async (c) => {
457457 }
458458} ) ;
459459
460- app . get ( '/extensions/ categories' , async ( c ) => {
460+ app . get ( '/categories' , async ( c ) => {
461461 const categories = await prisma . extensionCategory . findMany ( {
462462 select : {
463463 id : true ,
@@ -473,7 +473,7 @@ app.get('/extensions/categories', async (c) => {
473473 } ) ) ) ;
474474} ) ;
475475
476- app . get ( '/extensions/ search' , async ( c ) => {
476+ app . get ( '/search' , async ( c ) => {
477477 try {
478478 const query = c . req . query ( 'q' ) ;
479479 const page = Math . max ( 1 , parseInt ( c . req . query ( 'page' ) || '1' , 10 ) ) ;
@@ -559,7 +559,7 @@ app.get('/extensions/search', async (c) => {
559559const downloadIpMap = new Map < string , Set < string > > ( ) ;
560560
561561// Get detailed information about a specific extension
562- app . get ( '/extensions/ :author/:name' , async ( c ) => {
562+ app . get ( '/:author/:name' , async ( c ) => {
563563 const author = c . req . param ( 'author' ) ;
564564 const name = c . req . param ( 'name' ) ;
565565 const storage = c . var . storage ;
@@ -578,7 +578,7 @@ app.get('/extensions/:author/:name', async (c) => {
578578// Download zip archive and count download
579579// We use an in-memory IP map to not duplicate downloads for the same IP per extension.
580580// GitHub usernames are case-insensitive, so we normalize to lowercase for lookups
581- app . get ( '/extensions/ :author/:name/download' , async ( c ) => {
581+ app . get ( '/:author/:name/download' , async ( c ) => {
582582 const author = c . req . param ( 'author' ) . toLowerCase ( ) ; // Normalize to lowercase
583583 const name = c . req . param ( 'name' ) ;
584584 const storage = c . var . storage ;
@@ -619,7 +619,7 @@ app.get('/extensions/:author/:name/download', async (c) => {
619619 } ) ;
620620} ) ;
621621
622- app . get ( '/extensions/ list' , async ( c ) => {
622+ app . get ( '/list' , async ( c ) => {
623623 try {
624624 const page = Math . max ( 1 , parseInt ( c . req . query ( 'page' ) || '1' , 10 ) ) ;
625625 const limit = Math . min (
@@ -693,7 +693,7 @@ app.get('/extensions/list', async (c) => {
693693 }
694694} ) ;
695695
696- app . post ( '/extensions/ update-trending' , async ( c ) => {
696+ app . post ( '/update-trending' , async ( c ) => {
697697 const authHeader = c . req . header ( 'Authorization' ) ;
698698 if ( ! authHeader || authHeader !== `Bearer ${ API_SECRET } ` ) {
699699 return c . json ( { error : 'Unauthorized' } , 401 ) ;
0 commit comments