File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -44,18 +44,23 @@ export function createNextRouteHandler(
4444
4545export function createScriptHandler ( ) {
4646 return async function GET ( req : Request ) {
47- if ( ! req . url . endsWith ( 'op1.js' ) ) {
47+ const url = new URL ( req . url ) ;
48+ const query = url . searchParams . toString ( ) ;
49+
50+ if ( ! url . pathname . endsWith ( 'op1.js' ) ) {
4851 return NextResponse . json ( { error : 'Not found' } , { status : 404 } ) ;
4952 }
5053
5154 const scriptUrl = 'https://openpanel.dev/op1.js' ;
5255 try {
5356 const res = await fetch ( scriptUrl , {
54- // @ts -expect-error
57+ // @ts -ignore
5558 next : { revalidate : 86400 } ,
5659 } ) ;
5760 const text = await res . text ( ) ;
58- const etag = `"${ createHash ( 'md5' ) . update ( text ) . digest ( 'hex' ) } "` ;
61+ const etag = `"${ createHash ( 'md5' )
62+ . update ( text + query )
63+ . digest ( 'hex' ) } "`;
5964 return new NextResponse ( text , {
6065 headers : {
6166 'Content-Type' : 'text/javascript' ,
Original file line number Diff line number Diff line change 11{
22 "name" : " @openpanel/nextjs" ,
3- "version" : " 1.0.19 -local" ,
3+ "version" : " 1.0.20 -local" ,
44 "module" : " index.ts" ,
55 "scripts" : {
66 "build" : " rm -rf dist && tsup" ,
You can’t perform that action at this time.
0 commit comments