Compare commits
No commits in common. "v3.1.0" and "main" have entirely different histories.
13 changed files with 8 additions and 140 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
Hooks.on(`renderSettings`, (app, html) => {
|
Hooks.on(`renderSettings`, (app, html, ctx, options) => {
|
||||||
/** @type {HTMLElement|undefined} */
|
/** @type {HTMLElement|undefined} */
|
||||||
const coreUpdateTooltip = html.querySelector(`.build .value a`);
|
const coreUpdateTooltip = html.querySelector(`.build .value a`);
|
||||||
coreUpdateTooltip?.remove();
|
coreUpdateTooltip?.remove();
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,6 @@
|
||||||
"hint": "This removes the default attributes that are applied when a new actor is created, making it so that no attributes get created alongside the actor.",
|
"hint": "This removes the default attributes that are applied when a new actor is created, making it so that no attributes get created alongside the actor.",
|
||||||
"label": "Remove Attributes"
|
"label": "Remove Attributes"
|
||||||
},
|
},
|
||||||
"betaChannel": {
|
|
||||||
"name": "Beta Release Notifications",
|
|
||||||
"hint": "Whether or not to receive notifications about new beta releases for the system. If left unchecked, you will still receive notifications about new versions, but only for stable versions."
|
|
||||||
},
|
|
||||||
"canPlayersManageAttributes": {
|
"canPlayersManageAttributes": {
|
||||||
"name": "Players Can Manage Attributes",
|
"name": "Players Can Manage Attributes",
|
||||||
"hint": "This allows players who have edit access to a document to be able to edit what attributes those characters have via the attribute editor"
|
"hint": "This allows players who have edit access to a document to be able to edit what attributes those characters have via the attribute editor"
|
||||||
|
|
@ -76,7 +72,6 @@
|
||||||
"releases": "Releases",
|
"releases": "Releases",
|
||||||
"wiki": "Wiki",
|
"wiki": "Wiki",
|
||||||
"issues": "Issues",
|
"issues": "Issues",
|
||||||
"new-version-available": "{version} available now!",
|
|
||||||
"item": {
|
"item": {
|
||||||
"weight": "Weight",
|
"weight": "Weight",
|
||||||
"quantity": "Quantity",
|
"quantity": "Quantity",
|
||||||
|
|
@ -160,8 +155,7 @@
|
||||||
"migration-in-progress": "Applying data migrations for version {version}. Please do NOT refresh the window while this warning is present."
|
"migration-in-progress": "Applying data migrations for version {version}. Please do NOT refresh the window while this warning is present."
|
||||||
},
|
},
|
||||||
"success": {
|
"success": {
|
||||||
"saved-default-attributes": "Successfully saved default Actor attributes.",
|
"saved-default-attributes": "Successfully saved default Actor attributes",
|
||||||
"removed-default-attributes": "The default attributes for Actors have been removed.",
|
|
||||||
"migration-successful": "Data migrations for version {version} were successful."
|
"migration-successful": "Data migrations for version {version} were successful."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
import { filePath } from "../../consts.mjs";
|
import { filePath } from "../../consts.mjs";
|
||||||
import { getLatestVersion } from "../../utils/ReleaseChannels.mjs";
|
|
||||||
|
|
||||||
const { isNewerVersion } = foundry.utils;
|
|
||||||
const { renderTemplate } = foundry.applications.handlebars;
|
const { renderTemplate } = foundry.applications.handlebars;
|
||||||
const { Settings } = foundry.applications.sidebar.tabs;
|
const { Settings } = foundry.applications.sidebar.tabs;
|
||||||
|
|
||||||
|
|
@ -15,15 +13,9 @@ export class TAFSettingsSidebar extends Settings {
|
||||||
// add the more customized system info into the sidebar
|
// add the more customized system info into the sidebar
|
||||||
const systemBlock = this.element.querySelector(`section.system`);
|
const systemBlock = this.element.querySelector(`section.system`);
|
||||||
if (!systemBlock) {
|
if (!systemBlock) {
|
||||||
const latest = await getLatestVersion();
|
|
||||||
const latestVersion = latest.tag_name.slice(1);
|
|
||||||
const htmlString = await renderTemplate(
|
const htmlString = await renderTemplate(
|
||||||
filePath(`templates/settings-sidebar-addition.hbs`),
|
filePath(`templates/settings-sidebar-addition.hbs`),
|
||||||
{
|
{ system: game.system, },
|
||||||
system: game.system,
|
|
||||||
hasNewVersion: isNewerVersion(latestVersion, game.system.version),
|
|
||||||
newVersion: latest.tag_name,
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const temp = document.createElement(`div`);
|
const temp = document.createElement(`div`);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ import { TAFMacro } from "../documents/Macro.mjs";
|
||||||
import { TAFTokenDocument } from "../documents/Token.mjs";
|
import { TAFTokenDocument } from "../documents/Token.mjs";
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
import { registerReleaseSettings } from "../utils/ReleaseChannels.mjs";
|
|
||||||
import { registerWorldSettings } from "../settings/world.mjs";
|
import { registerWorldSettings } from "../settings/world.mjs";
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
|
|
@ -90,7 +89,6 @@ Hooks.on(`init`, () => {
|
||||||
);
|
);
|
||||||
// #endregion Sheets
|
// #endregion Sheets
|
||||||
|
|
||||||
registerReleaseSettings();
|
|
||||||
registerWorldSettings();
|
registerWorldSettings();
|
||||||
|
|
||||||
registerSockets();
|
registerSockets();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import { checkForNewReleases } from "../utils/ReleaseChannels.mjs";
|
|
||||||
import { checkMigrations } from "../migrations/checkMigrations.mjs";
|
import { checkMigrations } from "../migrations/checkMigrations.mjs";
|
||||||
|
|
||||||
Hooks.on(`ready`, () => {
|
Hooks.on(`ready`, () => {
|
||||||
|
|
@ -8,5 +7,4 @@ Hooks.on(`ready`, () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
checkMigrations();
|
checkMigrations();
|
||||||
checkForNewReleases();
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,6 @@ Hooks.on(`renderSettingsConfig`, (app, html) => {
|
||||||
button.innerHTML = _loc(`taf.settings.actorDefaultAttributes.label`);
|
button.innerHTML = _loc(`taf.settings.actorDefaultAttributes.label`);
|
||||||
button.addEventListener(`click`, () => {
|
button.addEventListener(`click`, () => {
|
||||||
game.settings.set(__ID__, `actorDefaultAttributes`, undefined);
|
game.settings.set(__ID__, `actorDefaultAttributes`, undefined);
|
||||||
formGroup.remove();
|
|
||||||
ui.notifications.success(_loc(`taf.notifs.success.removed-default-attributes`));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const hint = document.createElement(`p`);
|
const hint = document.createElement(`p`);
|
||||||
|
|
|
||||||
|
|
@ -1,75 +0,0 @@
|
||||||
import { __ID__, filePath } from "../consts.mjs";
|
|
||||||
import { Logger } from "./Logger.mjs";
|
|
||||||
|
|
||||||
const { ChatMessage } = foundry.documents;
|
|
||||||
const { renderTemplate } = foundry.applications.handlebars;
|
|
||||||
const { fetchJsonWithTimeout, isNewerVersion } = foundry.utils;
|
|
||||||
|
|
||||||
let newestVersion = null;
|
|
||||||
|
|
||||||
async function fetchLatestVersion() {
|
|
||||||
const includeBetas = game.settings.get(__ID__, `betaChannel`);
|
|
||||||
try {
|
|
||||||
const releases = await fetchJsonWithTimeout(`https://git.varify.ca/api/v1/repos/Foundry/taf/releases?pre-release=${includeBetas}&limit=1`);
|
|
||||||
return releases.at(0);
|
|
||||||
} catch {
|
|
||||||
Logger.error(`Failed to fetch latest version from Forgejo, halting version checks`);
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export async function getLatestVersion() {
|
|
||||||
if (!newestVersion) {
|
|
||||||
newestVersion = await fetchLatestVersion();
|
|
||||||
};
|
|
||||||
return newestVersion;
|
|
||||||
};
|
|
||||||
|
|
||||||
export async function checkForNewReleases() {
|
|
||||||
// Only perform the update check if the game is ready and the user is the active GM
|
|
||||||
if (!game.user.isActiveGM || !game.ready) { return };
|
|
||||||
|
|
||||||
// Don't do any version notifications if this is a fresh world
|
|
||||||
const lastNotifiedVersion = game.settings.get(__ID__, `lastUpdateNotified`);
|
|
||||||
if (!lastNotifiedVersion) {
|
|
||||||
game.settings.set(__ID__, `lastUpdateNotified`, game.system.version);
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
let latest = newestVersion = await getLatestVersion();
|
|
||||||
|
|
||||||
// Is the latest release newer than the previously notified release
|
|
||||||
const latestVersion = latest.tag_name.replace(/^v/, ``);
|
|
||||||
if (!isNewerVersion(latestVersion, lastNotifiedVersion)) { return };
|
|
||||||
|
|
||||||
const content = await renderTemplate(
|
|
||||||
filePath(`templates/new-version-message.hbs`),
|
|
||||||
{
|
|
||||||
release: latest,
|
|
||||||
system: game.system,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
ChatMessage.implementation.create({
|
|
||||||
whisper: [ game.user.id ],
|
|
||||||
content,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Mark the new version as the
|
|
||||||
game.settings.set(__ID__, `lastUpdateNotified`, latestVersion);
|
|
||||||
};
|
|
||||||
|
|
||||||
export function registerReleaseSettings() {
|
|
||||||
game.settings.register(__ID__, `betaChannel`, {
|
|
||||||
name: `${__ID__}.settings.betaChannel.name`,
|
|
||||||
hint: `${__ID__}.settings.betaChannel.hint`,
|
|
||||||
config: true,
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
scope: `world`,
|
|
||||||
});
|
|
||||||
|
|
||||||
game.settings.register(__ID__, `lastUpdateNotified`, {
|
|
||||||
config: false,
|
|
||||||
type: String,
|
|
||||||
scope: `world`,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
@ -26,10 +26,4 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
|
||||||
text-align: center;
|
|
||||||
font-size: small;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,6 @@
|
||||||
@import url("./elements/span.css") layer(elements);
|
@import url("./elements/span.css") layer(elements);
|
||||||
@import url("./elements/table.css") layer(elements);
|
@import url("./elements/table.css") layer(elements);
|
||||||
|
|
||||||
/* Partials */
|
|
||||||
@import url("./misc.css") layer(partials);
|
|
||||||
|
|
||||||
/* Apps */
|
/* Apps */
|
||||||
@import url("./Apps/common.css") layer(apps);
|
@import url("./Apps/common.css") layer(apps);
|
||||||
@import url("./Apps/Ask.css") layer(apps);
|
@import url("./Apps/Ask.css") layer(apps);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
.taf-chat-version-notif {
|
|
||||||
h2 {
|
|
||||||
font-family: var(--font-body);
|
|
||||||
font-size: 1.5rem;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -55,6 +55,7 @@
|
||||||
},
|
},
|
||||||
"socket": true,
|
"socket": true,
|
||||||
"flags": {
|
"flags": {
|
||||||
|
"forgejo_api": "https://git.varify.ca/api/v1",
|
||||||
"hotReload": {
|
"hotReload": {
|
||||||
"extensions": ["css", "hbs", "json", "js", "mjs", "svg"],
|
"extensions": ["css", "hbs", "json", "js", "mjs", "svg"],
|
||||||
"paths": ["templates", "langs", "styles", "module", "assets"]
|
"paths": ["templates", "langs", "styles", "module", "assets"]
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
<div class="taf-chat-version-notif">
|
|
||||||
<h2>
|
|
||||||
{{ system.title }}
|
|
||||||
{{ release.tag_name }}
|
|
||||||
</h2>
|
|
||||||
<p>
|
|
||||||
A new {{ifThen release.prerelease "beta" ""}} version of {{ system.title }} has been released.
|
|
||||||
</p>
|
|
||||||
<a
|
|
||||||
class="button"
|
|
||||||
href="{{ release.html_url }}"
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
>
|
|
||||||
Release Notes
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
href="{{ system.url }}/releases/tag/v{{ system.version }}"
|
href="{{ system.url }}/releases/tag/v{{ system.version }}"
|
||||||
class="whats-new"
|
class="whats-new"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noopener noreferrer"
|
||||||
style="font-size: smaller"
|
style="font-size: smaller"
|
||||||
>
|
>
|
||||||
{{localize "taf.misc.whats-new"}}
|
{{localize "taf.misc.whats-new"}}
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
<a
|
<a
|
||||||
href="{{ system.url }}/releases"
|
href="{{ system.url }}/releases"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
{{localize "taf.misc.releases"}}
|
{{localize "taf.misc.releases"}}
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
<a
|
<a
|
||||||
href="{{ system.url }}/wiki"
|
href="{{ system.url }}/wiki"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
{{localize "taf.misc.wiki"}}
|
{{localize "taf.misc.wiki"}}
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -39,15 +39,10 @@
|
||||||
<a
|
<a
|
||||||
href="{{ system.url }}/issues"
|
href="{{ system.url }}/issues"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
{{localize "taf.misc.issues"}}
|
{{localize "taf.misc.issues"}}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{{#if hasNewVersion}}
|
|
||||||
<p>
|
|
||||||
{{localize "taf.misc.new-version-available" version=newVersion}}
|
|
||||||
</p>
|
|
||||||
{{/if}}
|
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue