@@ -1042,6 +1042,38 @@ function renderFeaturePanel(state){
10421042 ` ) ;
10431043 }
10441044
1045+ if ( hasSimkl ( state ) ) {
1046+ const sm = ( state . cfgRaw ?. simkl ) || { } ;
1047+ parts . push ( `
1048+ <div class="panel-title small" style="margin-top:6px">SIMKL</div>
1049+ <details id="cx-sm-wl">
1050+ <summary class="muted" style="margin-bottom:10px;">SIMKL watchlist controls</summary>
1051+ <div class="grid2 compact">
1052+ <div class="opt-row" style="grid-column:1/-1">
1053+ <label for="sm-wl-batch">Batch size</label>
1054+ <input id="sm-wl-batch" class="input small" type="number" min="1" max="1000" value="${ sm . watchlist_batch_size ?? 500 } ">
1055+ </div>
1056+ </div>
1057+ </details>
1058+ ` ) ;
1059+ }
1060+
1061+ if ( hasMDBList ( state ) ) {
1062+ const md = ( state . cfgRaw ?. mdblist ) || { } ;
1063+ parts . push ( `
1064+ <div class="panel-title small" style="margin-top:6px">MDBList</div>
1065+ <details id="cx-md-wl">
1066+ <summary class="muted" style="margin-bottom:10px;">MDBList watchlist controls</summary>
1067+ <div class="grid2 compact">
1068+ <div class="opt-row" style="grid-column:1/-1">
1069+ <label for="md-wl-batch">Batch size</label>
1070+ <input id="md-wl-batch" class="input small" type="number" min="1" max="1000" value="${ md . watchlist_batch_size ?? 500 } ">
1071+ </div>
1072+ </div>
1073+ </details>
1074+ ` ) ;
1075+ }
1076+
10451077 right . innerHTML = parts . join ( "" ) ;
10461078 applySubDisable ( "watchlist" ) ;
10471079 return ;
@@ -1102,6 +1134,46 @@ function renderFeaturePanel(state){
11021134 ` ) ;
11031135 }
11041136
1137+ if ( hasSimkl ( state ) ) {
1138+ const sm = ( state . cfgRaw ?. simkl ) || { } ;
1139+ parts . push ( `
1140+ <div class="panel-title small" style="margin-top:6px">SIMKL</div>
1141+ <details id="cx-sm-rt">
1142+ <summary class="muted" style="margin-bottom:10px;">SIMKL ratings controls</summary>
1143+ <div class="grid2 compact">
1144+ <div class="opt-row" style="grid-column:1/-1">
1145+ <label for="sm-rt-chunk">Write chunk size</label>
1146+ <input id="sm-rt-chunk" class="input small" type="number" min="1" max="1000" value="${ sm . ratings_chunk_size ?? 500 } ">
1147+ </div>
1148+ </div>
1149+ </details>
1150+ ` ) ;
1151+ }
1152+
1153+ if ( hasMDBList ( state ) ) {
1154+ const md = ( state . cfgRaw ?. mdblist ) || { } ;
1155+ parts . push ( `
1156+ <div class="panel-title small" style="margin-top:6px">MDBList</div>
1157+ <details id="cx-md-rt">
1158+ <summary class="muted" style="margin-bottom:10px;">MDBList ratings controls</summary>
1159+ <div class="grid2 compact">
1160+ <div class="opt-row">
1161+ <label for="md-rt-perpage">Items per page</label>
1162+ <input id="md-rt-perpage" class="input small" type="number" min="1" max="5000" value="${ md . ratings_per_page ?? 200 } ">
1163+ </div>
1164+ <div class="opt-row">
1165+ <label for="md-rt-maxpages">Max pages</label>
1166+ <input id="md-rt-maxpages" class="input small" type="number" min="1" max="2000" value="${ md . ratings_max_pages ?? 50 } ">
1167+ </div>
1168+ <div class="opt-row" style="grid-column:1/-1">
1169+ <label for="md-rt-chunk">Write chunk size</label>
1170+ <input id="md-rt-chunk" class="input small" type="number" min="1" max="1000" value="${ md . ratings_chunk_size ?? 500 } ">
1171+ </div>
1172+ </div>
1173+ </details>
1174+ ` ) ;
1175+ }
1176+
11051177 if ( hasSimkl ( state ) ) {
11061178 parts . push ( `<div class="simkl-alert" role="note" aria-live="polite"><div class="title"><span class="ic">⚠</span> Simkl heads-up for Ratings</div><div class="body"><ul class="bul"><li><b>Movies:</b> Rating auto-marks as <i>Completed</i> on Simkl.</li><li>Can appear under <i>Recently watched</i> and <i>My List</i>.</li></ul><div class="mini">Tip: Prefer small windows when backfilling.</div></div></div>` ) ;
11071179 }
@@ -1231,6 +1303,58 @@ left.innerHTML = `
12311303 <label for="cx-tr-hs-unres">Unresolved Freeze</label>
12321304 <label class="switch"><input id="cx-tr-hs-unres" type="checkbox" ${ trCfg . history_unresolved ? "checked" : "" } ><span class="slider"></span></label>
12331305 </div>
1306+ <div class="opt-row">
1307+ <label for="tr-hs-perpage">Items per page</label>
1308+ <input id="tr-hs-perpage" class="input small" type="number" min="1" max="500" value="${ trCfg . history_per_page ?? 100 } ">
1309+ </div>
1310+ <div class="opt-row">
1311+ <label for="tr-hs-maxpages">Max pages</label>
1312+ <input id="tr-hs-maxpages" class="input small" type="number" min="1" max="100000" value="${ trCfg . history_max_pages ?? 10000 } ">
1313+ </div>
1314+ <div class="opt-row" style="grid-column:1/-1">
1315+ <label for="tr-hs-chunk">Write chunk size</label>
1316+ <input id="tr-hs-chunk" class="input small" type="number" min="1" max="1000" value="${ trCfg . history_chunk_size ?? 100 } ">
1317+ </div>
1318+ </div>
1319+ </details>
1320+ ` ) ;
1321+ }
1322+
1323+ if ( hasSimkl ( state ) ) {
1324+ const sm = ( state . cfgRaw ?. simkl ) || { } ;
1325+ parts . push ( `
1326+ <div class="panel-title small" style="margin-top:6px">SIMKL</div>
1327+ <details id="cx-sm-hs">
1328+ <summary class="muted" style="margin-bottom:10px;">SIMKL history controls</summary>
1329+ <div class="grid2 compact">
1330+ <div class="opt-row" style="grid-column:1/-1">
1331+ <label for="sm-hs-chunk">Write chunk size</label>
1332+ <input id="sm-hs-chunk" class="input small" type="number" min="1" max="1000" value="${ sm . history_chunk_size ?? 500 } ">
1333+ </div>
1334+ </div>
1335+ </details>
1336+ ` ) ;
1337+ }
1338+
1339+ if ( hasMDBList ( state ) ) {
1340+ const md = ( state . cfgRaw ?. mdblist ) || { } ;
1341+ parts . push ( `
1342+ <div class="panel-title small" style="margin-top:6px">MDBList</div>
1343+ <details id="cx-md-hs">
1344+ <summary class="muted" style="margin-bottom:10px;">MDBList history controls</summary>
1345+ <div class="grid2 compact">
1346+ <div class="opt-row">
1347+ <label for="md-hs-perpage">Items per page</label>
1348+ <input id="md-hs-perpage" class="input small" type="number" min="1" max="5000" value="${ md . history_per_page ?? 1000 } ">
1349+ </div>
1350+ <div class="opt-row">
1351+ <label for="md-hs-maxpages">Max pages</label>
1352+ <input id="md-hs-maxpages" class="input small" type="number" min="1" max="2000" value="${ md . history_max_pages ?? 250 } ">
1353+ </div>
1354+ <div class="opt-row" style="grid-column:1/-1">
1355+ <label for="md-hs-chunk">Write chunk size</label>
1356+ <input id="md-hs-chunk" class="input small" type="number" min="1" max="1000" value="${ md . history_chunk_size ?? 500 } ">
1357+ </div>
12341358 </div>
12351359 </details>
12361360 ` ) ;
@@ -1753,6 +1877,18 @@ async function saveConfigBits(state){
17531877 } ) ;
17541878 }
17551879
1880+ if ( ID ( "sm-wl-batch" ) ) {
1881+ cfg . simkl = Object . assign ( { } , cfg . simkl || { } , {
1882+ watchlist_batch_size : Math . max ( 1 , parseInt ( ID ( "sm-wl-batch" ) ?. value || "500" , 10 ) || 500 )
1883+ } ) ;
1884+ }
1885+
1886+ if ( ID ( "md-wl-batch" ) ) {
1887+ cfg . mdblist = Object . assign ( { } , cfg . mdblist || { } , {
1888+ watchlist_batch_size : Math . max ( 1 , parseInt ( ID ( "md-wl-batch" ) ?. value || "500" , 10 ) || 500 )
1889+ } ) ;
1890+ }
1891+
17561892 const hasJF = String ( state . src || "" ) . toUpperCase ( ) === "JELLYFIN" || String ( state . dst || "" ) . toUpperCase ( ) === "JELLYFIN" ;
17571893 if ( hasJF ) {
17581894 const jf = Object . assign ( { } , cfg . jellyfin || { } ) ;
@@ -1806,14 +1942,54 @@ async function saveConfigBits(state){
18061942 const perEl = ID ( "tr-rt-perpage" ) || ID ( "tr-rt-page" ) ;
18071943 const pagesEl = ID ( "tr-rt-maxpages" ) || ID ( "tr-rt-pages" ) ;
18081944 const chunkEl = ID ( "tr-rt-chunk" ) ;
1945+ const hsPerEl = ID ( "tr-hs-perpage" ) ;
1946+ const hsPagesEl = ID ( "tr-hs-maxpages" ) ;
1947+ const hsChunkEl = ID ( "tr-hs-chunk" ) ;
18091948
18101949 if ( perEl ) tr . ratings_per_page = clamp ( n ( perEl . id ) , 10 , 500 ) ;
18111950 if ( pagesEl ) tr . ratings_max_pages = clamp ( n ( pagesEl . id ) , 1 , 1000 ) ;
18121951 if ( chunkEl ) tr . ratings_chunk_size = clamp ( n ( chunkEl . id ) , 10 , 1000 ) ;
1952+ if ( hsPerEl ) tr . history_per_page = clamp ( n ( hsPerEl . id ) , 1 , 500 ) ;
1953+ if ( hsPagesEl ) tr . history_max_pages = clamp ( n ( hsPagesEl . id ) , 1 , 100000 ) ;
1954+ if ( hsChunkEl ) tr . history_chunk_size = clamp ( n ( hsChunkEl . id ) , 1 , 1000 ) ;
18131955
18141956 cfg . trakt = tr ;
18151957 }
18161958
1959+ const hasSM = String ( state . src || "" ) . toUpperCase ( ) === "SIMKL" || String ( state . dst || "" ) . toUpperCase ( ) === "SIMKL" ;
1960+ if ( hasSM ) {
1961+ const sm = Object . assign ( { } , cfg . simkl || { } ) ;
1962+ const wlBatchEl = ID ( "sm-wl-batch" ) ;
1963+ const rtChunkEl = ID ( "sm-rt-chunk" ) ;
1964+ const hsChunkEl = ID ( "sm-hs-chunk" ) ;
1965+ if ( wlBatchEl ) sm . watchlist_batch_size = Math . max ( 1 , parseInt ( wlBatchEl . value || "500" , 10 ) || 500 ) ;
1966+ if ( rtChunkEl ) sm . ratings_chunk_size = Math . max ( 1 , parseInt ( rtChunkEl . value || "500" , 10 ) || 500 ) ;
1967+ if ( hsChunkEl ) sm . history_chunk_size = Math . max ( 1 , parseInt ( hsChunkEl . value || "500" , 10 ) || 500 ) ;
1968+ cfg . simkl = sm ;
1969+ }
1970+
1971+ const hasMD = String ( state . src || "" ) . toUpperCase ( ) === "MDBLIST" || String ( state . dst || "" ) . toUpperCase ( ) === "MDBLIST" ;
1972+ if ( hasMD ) {
1973+ const md = Object . assign ( { } , cfg . mdblist || { } ) ;
1974+ const n = x => parseInt ( ( ID ( x ) ?. value || "" ) . trim ( ) , 10 ) ;
1975+ const clamp = ( v , min , max ) => Math . min ( max , Math . max ( min , Number . isFinite ( v ) ?v :min ) ) ;
1976+ const wlBatchEl = ID ( "md-wl-batch" ) ;
1977+ const rtPerEl = ID ( "md-rt-perpage" ) ;
1978+ const rtPagesEl = ID ( "md-rt-maxpages" ) ;
1979+ const rtChunkEl = ID ( "md-rt-chunk" ) ;
1980+ const hsPerEl = ID ( "md-hs-perpage" ) ;
1981+ const hsPagesEl = ID ( "md-hs-maxpages" ) ;
1982+ const hsChunkEl = ID ( "md-hs-chunk" ) ;
1983+ if ( wlBatchEl ) md . watchlist_batch_size = clamp ( n ( wlBatchEl . id ) , 1 , 1000 ) ;
1984+ if ( rtPerEl ) md . ratings_per_page = clamp ( n ( rtPerEl . id ) , 1 , 5000 ) ;
1985+ if ( rtPagesEl ) md . ratings_max_pages = clamp ( n ( rtPagesEl . id ) , 1 , 2000 ) ;
1986+ if ( rtChunkEl ) md . ratings_chunk_size = clamp ( n ( rtChunkEl . id ) , 1 , 1000 ) ;
1987+ if ( hsPerEl ) md . history_per_page = clamp ( n ( hsPerEl . id ) , 1 , 5000 ) ;
1988+ if ( hsPagesEl ) md . history_max_pages = clamp ( n ( hsPagesEl . id ) , 1 , 2000 ) ;
1989+ if ( hsChunkEl ) md . history_chunk_size = clamp ( n ( hsChunkEl . id ) , 1 , 1000 ) ;
1990+ cfg . mdblist = md ;
1991+ }
1992+
18171993 const res = await fetch ( "/api/config" , { method :"POST" , headers :{ "Content-Type" :"application/json" } , body :JSON . stringify ( cfg ) } ) ;
18181994 if ( ! res . ok ) throw new Error ( "POST /api/config " + res . status ) ;
18191995 } catch ( e ) { console . warn ( "[cx] saving config bits failed" , e ) }
0 commit comments