File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
src/routes/[username]/[slug]/config Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -29,9 +29,17 @@ export const GET: RequestHandler = async ({ platform, params }) => {
2929 return json ( { error : 'Config is private' } , { status : 403 } ) ;
3030 }
3131
32- const packages = JSON . parse ( config . packages || '[]' ) ;
32+ const packages : string [ ] = JSON . parse ( config . packages || '[]' ) ;
33+
34+ const tapsSet = new Set < string > ( ) ;
35+
36+ for ( const pkg of packages ) {
37+ const parts = pkg . split ( '/' ) ;
38+ if ( parts . length === 3 ) {
39+ tapsSet . add ( `${ parts [ 0 ] } /${ parts [ 1 ] } ` ) ;
40+ }
41+ }
3342
34- let taps : string [ ] = [ ] ;
3543 const snapshotRow = await env . DB . prepare (
3644 'SELECT snapshot FROM configs WHERE user_id = ? AND slug = ?'
3745 )
@@ -41,12 +49,16 @@ export const GET: RequestHandler = async ({ platform, params }) => {
4149 if ( snapshotRow ?. snapshot ) {
4250 try {
4351 const snapshot = JSON . parse ( snapshotRow . snapshot ) ;
44- taps = snapshot . packages ?. taps || [ ] ;
52+ const snapshotTaps = snapshot . packages ?. taps || [ ] ;
53+ for ( const tap of snapshotTaps ) {
54+ tapsSet . add ( tap ) ;
55+ }
4556 } catch {
46- taps = [ ] ;
4757 }
4858 }
4959
60+ const taps = Array . from ( tapsSet ) ;
61+
5062 return json ( {
5163 username : user . username ,
5264 slug : config . slug ,
You can’t perform that action at this time.
0 commit comments