Updated the data reading to have a data request limit, also updated docs

on new configuration options
This commit is contained in:
2025-11-27 11:44:27 +00:00
parent 7d38752f34
commit 54b6f018cf
3 changed files with 8 additions and 3 deletions

View File

@@ -78,10 +78,13 @@ export function getdata(data_type, key=-1, value=-1) {
case 'comments':
result = func.require_module(`../data/${data_type}.json`)
if (key != -1) {
if (key == 'id' && value < result.length) { // id is the index
return result[value]
}
return result[func.find_key_value_pair(result, key, value)]
return -1 // This index doesn't exist
}
return result
return result.slice(- config['data_request_limit'])
break;
case 'hitcount':
result = func.require_module('../data/data.json') // This file is actually called data.json