Content deleted Content added
(bot/CD) |
(bot/CD) |
||
Line 346:
var version = "0.4.2";
var gitAbbrevHash = "
var gitBranch = "main";
var gitDate = "
var gitVersion = "0.4.2+
/**
Line 13,194:
*
* @param sourcePage The specific page to load from
* @return A WikiConfiguration object
*/
static load(sourcePage) {
Line 13,207 ⟶ 13,208:
}
/**
*
* settings. This allows for faster loads at the expense of a (small)
* chance of outdated configuration.
* The localStorage layer allows fast browser-based caching. If a user
* is logging in again on another device, the user configuration
* will automatically be sent to the client, lessening turnaround time.
* If all else fails, the configuration will be loaded from the wiki.
*
* @return A WikiConfiguration object.
*/
static loadFromLocal() {
return __awaiter(this, void 0, void 0, function* () {
let
// If `mw.storage.get` returns `false` or `null`, it'll be thrown up.
▲ try {
let rawConfigInfo =
// Try to grab
if (!rawConfigInfo) {
}
}
catch (e) {
// Bad local! Switch to non-local.
console.error('Failed to get Deputy wiki configuration', e);
return this.loadFromWiki();
}
}
else {
console.log('No locally-cached Deputy configuration, pulling from wiki.');
return this.loadFromWiki();
}
if (
return new WikiConfiguration(new mw.Title(
}
else {
Line 13,234 ⟶ 13,254:
*
* @param sourcePage The specific page to load from
* @return A WikiConfiguration object
*/
static loadFromWiki(sourcePage) {
Line 13,337 ⟶ 13,358:
// Doesn't need to be from the same config page, since this usually means a new config
// page was made, and we need to switch to it.
if (this.core.lastEdited.get() < liveWikiConfig.core.lastEdited) {
const onSuccess = () => {
var _a;
Line 13,352 ⟶ 13,373:
// that sent the comms message.
if (!sourceConfig) {
▲ MwApi.action.saveOption(WikiConfiguration.optionKey,
// Use `liveWikiConfig`, since this contains the compressed version and is more
// bandwidth-friendly.
const rawConfigInfo = JSON.stringify({
title: fromWiki.title,
editable: fromWiki.editable,
wt: JSON.stringify(liveWikiConfig)
})
mw.storage.set(WikiConfiguration.optionKey, rawConfigInfo);
yield MwApi.action.saveOption(WikiConfiguration.optionKey, rawConfigInfo).then(() => {
var _a;
if ((_a = window.deputy) === null || _a === void 0 ? void 0 : _a.comms) {
Line 13,393 ⟶ 13,415:
action: 'edit',
title: this.sourcePage.getPrefixedText(),
text:
});
});
Line 13,421 ⟶ 13,443:
/**
* Shows the configuration edit intro banner, if applicable on this page.
*
* @return void
*/
prepareEditBanners() {
|