Add Compression options for Images

This commit is contained in:
glax 2024-10-27 03:44:06 +01:00
parent 4660f9a402
commit 363d4d7518
2 changed files with 35 additions and 4 deletions

View File

@ -120,6 +120,24 @@ export default function Settings({backendConnected, apiUri, settings, changeSett
}) })
} }
const SetCompressImages : ChangeEventHandler<HTMLInputElement> = (e) => {
console.info(`Updating ImageCompression ${e.target.checked}`);
postData(`${apiUri}/v2/Settings/CompressImages`, {value: e.target.checked})
.then((json) => {
//console.info(`Successfully updated ImageCompression ${e.target.checked}`);
UpdateBackendSettings();
})
}
const SetBWImages : ChangeEventHandler<HTMLInputElement> = (e) => {
console.info(`Updating B/W Images ${e.target.checked}`);
postData(`${apiUri}/v2/Settings/BWImages`, {value: e.target.checked})
.then((json) => {
//console.info(`Successfully updated B/W Images ${e.target.checked}`);
UpdateBackendSettings();
})
}
function RefreshInputs(){ function RefreshInputs(){
alert("Saved."); alert("Saved.");
setShowSettings(false); setShowSettings(false);
@ -141,14 +159,25 @@ export default function Settings({backendConnected, apiUri, settings, changeSett
<div className="section-item"> <div className="section-item">
<span className="settings-section-title">API Settings</span> <span className="settings-section-title">API Settings</span>
<label htmlFor="settingApiUri">API URI:</label> <label htmlFor="settingApiUri">API URI:</label>
<input placeholder={frontendSettings.apiUri} type="text" id="settingApiUri" onKeyDown={SubmitApiUri} /> <input placeholder={frontendSettings.apiUri} type="text" id="settingApiUri"
onKeyDown={SubmitApiUri}/>
<label htmlFor="userAgent">User Agent:</label> <label htmlFor="userAgent">User Agent:</label>
<input id="userAgent" type="text" placeholder={backendSettings != undefined ? backendSettings.userAgent : "UserAgent"} onKeyDown={SubmitUserAgent} /> <input id="userAgent" type="text"
placeholder={backendSettings != undefined ? backendSettings.userAgent : "UserAgent"}
onKeyDown={SubmitUserAgent}/>
<span id="resetUserAgent" onClick={ResetUserAgent}>Reset</span> <span id="resetUserAgent" onClick={ResetUserAgent}>Reset</span>
<label htmlFor="aprilFoolsMode">April Fools Mode</label> <label htmlFor="aprilFoolsMode">April Fools Mode</label>
<Toggle id="aprilFoolsMode" <Toggle id="aprilFoolsMode"
defaultChecked={backendSettings?.aprilFoolsMode ?? false} checked={backendSettings?.aprilFoolsMode ?? false}
onChange={SetAprilFoolsMode}/> onChange={SetAprilFoolsMode}/>
<label htmlFor="compressImages">Image Compression</label>
<Toggle id="compressImages"
checked={backendSettings?.compressImages ?? false}
onChange={SetCompressImages}/>
<label htmlFor="bwImages">B/W Images</label>
<Toggle id="bwImages"
checked={backendSettings?.bwImages ?? false}
onChange={SetBWImages}/>
</div> </div>
<div className="section-item"> <div className="section-item">
<span className="settings-section-title">Rate Limits</span> <span className="settings-section-title">Rate Limits</span>

View File

@ -7,6 +7,8 @@ export default interface IBackendSettings {
"bufferNotifications": boolean; "bufferNotifications": boolean;
"version": number; "version": number;
"aprilFoolsMode": boolean; "aprilFoolsMode": boolean;
"compressImages": boolean;
"bwImages": boolean;
"requestLimits": { "requestLimits": {
"MangaInfo": number; "MangaInfo": number;
"MangaDexFeed": number; "MangaDexFeed": number;