@@ -1409,7 +1409,7 @@ <h1>EPUB Reader Bot App</h1>
14091409 document . querySelector ( '.search-container' ) . style . display = 'block' ;
14101410 }
14111411
1412- async function renameBook ( oldName ) {
1412+ function renameBook ( oldName ) {
14131413 const userId = getUserId ( ) ;
14141414 if ( ! userId ) {
14151415 alert ( '无法获取用户信息' ) ;
@@ -1421,27 +1421,27 @@ <h1>EPUB Reader Bot App</h1>
14211421 const trimmedName = newName . trim ( ) ;
14221422 if ( trimmedName === "" || trimmedName === oldName ) return ;
14231423
1424- try {
1425- const targetUrl = new URL ( `${ API_BASE } /books/rename` ) ;
1426- targetUrl . searchParams . append ( 'userId' , userId ) ;
1427- targetUrl . searchParams . append ( 'oldName' , oldName ) ;
1428- targetUrl . searchParams . append ( 'newName' , trimmedName ) ;
1429-
1430- const response = await fetch ( targetUrl . toString ( ) , {
1431- method : 'POST'
1432- } ) ;
1424+ alert ( `✅ 重命名请求已提交!\n\n"${ oldName } " 即将变更为 "${ trimmedName } "。\n\n由于全球CDN缓存刷新需要时间,更改将在 1~2 分钟后生效,请稍后刷新页面查看。` ) ;
14331425
1434- const data = await response . json ( ) ;
1426+ const targetUrl = new URL ( `${ API_BASE } /books/rename` ) ;
1427+ targetUrl . searchParams . append ( 'userId' , userId ) ;
1428+ targetUrl . searchParams . append ( 'oldName' , oldName ) ;
1429+ targetUrl . searchParams . append ( 'newName' , trimmedName ) ;
14351430
1436- if ( data . success ) {
1437- alert ( "重命名成功!" ) ;
1438- await loadAllBooks ( currentBooksPage ) ;
1439- } else {
1440- alert ( "重命名失败: " + data . error ) ;
1441- }
1442- } catch ( e ) {
1443- alert ( "请求出错: " + e . message ) ;
1444- }
1431+ fetch ( targetUrl . toString ( ) , {
1432+ method : 'POST'
1433+ } )
1434+ . then ( response => response . json ( ) )
1435+ . then ( data => {
1436+ if ( data . success ) {
1437+ console . log ( `[后台日志] 书籍 "${ oldName } " 重命名成功` ) ;
1438+ } else {
1439+ console . error ( `[后台日志] 重命名失败: ${ data . error } ` ) ;
1440+ }
1441+ } )
1442+ . catch ( e => {
1443+ console . error ( `[后台日志] 请求网络错误: ${ e . message } ` ) ;
1444+ } ) ;
14451445 }
14461446</ script >
14471447
0 commit comments