Compare commits

...

5 Commits

Author SHA1 Message Date
FinnHornhoover
b752fd7e3e
Merge 51f0c06092 into ec0fc87dcd 2023-11-14 16:15:02 +00:00
FinnHornhoover
51f0c06092 fixed config json read, limited hash check 2023-11-13 23:06:38 +03:00
FinnHornhoover
695fcaebb6 fixed valdator function name 2023-11-13 22:43:58 +03:00
FinnHornhoover
01a4318db5 fixed hash check timing on config change 2023-11-13 20:05:02 +03:00
FinnHornhoover
4105472d3c added hash check when cache location is changed 2023-11-13 01:46:23 +03:00
2 changed files with 8 additions and 5 deletions

View File

@ -294,7 +294,7 @@ function restoreDefaultVersions() {
} }
function editConfig() { function editConfig() {
var jsonToModify = JSON.parse(remotefs.readJsonSync(configPath)); var jsonToModify = JSON.parse(remotefs.readFileSync(configPath));
jsonToModify["autoupdate-check"] = $("#editconfig-autoupdate").prop("checked"); jsonToModify["autoupdate-check"] = $("#editconfig-autoupdate").prop("checked");
jsonToModify["cache-swapping"] = $("#editconfig-cacheswapping").prop("checked"); jsonToModify["cache-swapping"] = $("#editconfig-cacheswapping").prop("checked");
@ -302,14 +302,17 @@ function editConfig() {
jsonToModify["verify-offline-cache"] = $("#editconfig-verifyofflinecache").prop("checked"); jsonToModify["verify-offline-cache"] = $("#editconfig-verifyofflinecache").prop("checked");
var dirInput = $("#editconfig-offlinecachelocation:text").val(); var dirInput = $("#editconfig-offlinecachelocation:text").val();
var shouldChangeRoot = (
jsonToModify["offline-cache-location"] = (
remotefs.existsSync(dirInput) && remotefs.existsSync(dirInput) &&
remotefs.statSync(dirInput).isDirectory() remotefs.statSync(dirInput).isDirectory()
) ? dirInput : offlineRoot; );
jsonToModify["offline-cache-location"] = shouldChangeRoot ? dirInput : offlineRoot;
remotefs.writeFileSync(configPath, JSON.stringify(jsonToModify, null, 4)); remotefs.writeFileSync(configPath, JSON.stringify(jsonToModify, null, 4));
loadConfig(); loadConfig();
if (shouldChangeRoot) handleCache("hash-check", null, "offline");
} }
function validateCacheLocation() { function validateCacheLocation() {

View File

@ -536,7 +536,7 @@
class="form-control form-row w-75" class="form-control form-row w-75"
id="editconfig-offlinecachelocation" id="editconfig-offlinecachelocation"
type="text" type="text"
oninput="validateCacheLocator()" oninput="validateCacheLocation()"
/> />
</form> </form>
</div> </div>