moderator-toolbox-nxg-for-reddit / util/persistence/settingsPortability

util/persistence/settingsPortability

Functions

exportSettings()

exportSettings(subreddit): Promise<void>

Defined in: extension/data/util/persistence/settingsPortability.ts:18

Backs up all current settings to the tbsettings wiki page of the given subreddit. Keys are stripped of the Toolbox. prefix before writing.

Parameters

subreddit

string

Returns

Promise<void>


importSettings()

importSettings(subreddit): Promise<void>

Defined in: extension/data/util/persistence/settingsPortability.ts:54

Restores settings from the settings backup page of the given subreddit, falling back to the Toolbox 6.x tbsettings page when the sub has no NXG backup yet. Sanitizes the imported data with DOMPurify before writing.

Parameters

subreddit

string

Returns

Promise<void>

Throws

When the imported settings cannot be verified (e.g. version too old or wiki unreadable).