(type, id, options, tags = '')
| 253 | } |
| 254 | |
| 255 | export async function setEntrySettings(type, id, options, tags = '') { |
| 256 | const tempOptions = {}; |
| 257 | if (options) { |
| 258 | for (const key in options) { |
| 259 | switch (key) { |
| 260 | case 'u': |
| 261 | case 'p': |
| 262 | tempOptions[key] = options[key]; |
| 263 | break; |
| 264 | default: |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | if (api.settings.get('malTags')) { |
| 269 | // TAG mode |
| 270 | tags = setUrlInTags(JSON.stringify(tempOptions), tags); |
| 271 | } else { |
| 272 | // No TAG mode |
| 273 | await api.storage.set(`tagSettings/${type}/${id}`, JSON.stringify(tempOptions)); |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | if (!Object.values(tempOptions).find(el => Boolean(el))) { |
| 278 | tags = setUrlInTags('', tags); |
| 279 | if (!api.settings.get('malTags')) { |
| 280 | await api.storage.remove(`tagSettings/${type}/${id}`); |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | return tags; |
| 285 | } |
| 286 | |
| 287 | export async function getEntrySettings(type, id, tags = '') { |
| 288 | const tempOptions: any = { |
nothing calls this directly
no test coverage detected