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} */
|
||||
const coreUpdateTooltip = html.querySelector(`.build .value a`);
|
||||
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.",
|
||||
"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": {
|
||||
"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"
|
||||
|
|
@ -76,7 +72,6 @@
|
|||
"releases": "Releases",
|
||||
"wiki": "Wiki",
|
||||
"issues": "Issues",
|
||||
"new-version-available": "{version} available now!",
|
||||
"item": {
|
||||
"weight": "Weight",
|
||||
"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."
|
||||
},
|
||||
"success": {
|
||||
"saved-default-attributes": "Successfully saved default Actor attributes.",
|
||||
"removed-default-attributes": "The default attributes for Actors have been removed.",
|
||||
"saved-default-attributes": "Successfully saved default Actor attributes",
|
||||
"migration-successful": "Data migrations for version {version} were successful."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import { filePath } from "../../consts.mjs";
|
||||
import { getLatestVersion } from "../../utils/ReleaseChannels.mjs";
|
||||
|
||||
const { isNewerVersion } = foundry.utils;
|
||||
const { renderTemplate } = foundry.applications.handlebars;
|
||||
const { Settings } = foundry.applications.sidebar.tabs;
|
||||
|
||||
|
|
@ -15,15 +13,9 @@ export class TAFSettingsSidebar extends Settings {
|
|||
// add the more customized system info into the sidebar
|
||||
const systemBlock = this.element.querySelector(`section.system`);
|
||||
if (!systemBlock) {
|
||||
const latest = await getLatestVersion();
|
||||
const latestVersion = latest.tag_name.slice(1);
|
||||
const htmlString = await renderTemplate(
|
||||
filePath(`templates/settings-sidebar-addition.hbs`),
|
||||
{
|
||||
system: game.system,
|
||||
hasNewVersion: isNewerVersion(latestVersion, game.system.version),
|
||||
newVersion: latest.tag_name,
|
||||
},
|
||||
{ system: game.system, },
|
||||
);
|
||||
|
||||
const temp = document.createElement(`div`);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import { TAFMacro } from "../documents/Macro.mjs";
|
|||
import { TAFTokenDocument } from "../documents/Token.mjs";
|
||||
|
||||
// Settings
|
||||
import { registerReleaseSettings } from "../utils/ReleaseChannels.mjs";
|
||||
import { registerWorldSettings } from "../settings/world.mjs";
|
||||
|
||||
// Utils
|
||||
|
|
@ -90,7 +89,6 @@ Hooks.on(`init`, () => {
|
|||
);
|
||||
// #endregion Sheets
|
||||
|
||||
registerReleaseSettings();
|
||||
registerWorldSettings();
|
||||
|
||||
registerSockets();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { checkForNewReleases } from "../utils/ReleaseChannels.mjs";
|
||||
import { checkMigrations } from "../migrations/checkMigrations.mjs";
|
||||
|
||||
Hooks.on(`ready`, () => {
|
||||
|
|
@ -8,5 +7,4 @@ Hooks.on(`ready`, () => {
|
|||
};
|
||||
|
||||
checkMigrations();
|
||||
checkForNewReleases();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ Hooks.on(`renderSettingsConfig`, (app, html) => {
|
|||
button.innerHTML = _loc(`taf.settings.actorDefaultAttributes.label`);
|
||||
button.addEventListener(`click`, () => {
|
||||
game.settings.set(__ID__, `actorDefaultAttributes`, undefined);
|
||||
formGroup.remove();
|
||||
ui.notifications.success(_loc(`taf.notifs.success.removed-default-attributes`));
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
text-align: center;
|
||||
font-size: small;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@
|
|||
@import url("./elements/span.css") layer(elements);
|
||||
@import url("./elements/table.css") layer(elements);
|
||||
|
||||
/* Partials */
|
||||
@import url("./misc.css") layer(partials);
|
||||
|
||||
/* Apps */
|
||||
@import url("./Apps/common.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,
|
||||
"flags": {
|
||||
"forgejo_api": "https://git.varify.ca/api/v1",
|
||||
"hotReload": {
|
||||
"extensions": ["css", "hbs", "json", "js", "mjs", "svg"],
|
||||
"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 }}"
|
||||
class="whats-new"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
rel="noopener noreferrer"
|
||||
style="font-size: smaller"
|
||||
>
|
||||
{{localize "taf.misc.whats-new"}}
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
<a
|
||||
href="{{ system.url }}/releases"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{{localize "taf.misc.releases"}}
|
||||
</a>
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
<a
|
||||
href="{{ system.url }}/wiki"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{{localize "taf.misc.wiki"}}
|
||||
</a>
|
||||
|
|
@ -39,15 +39,10 @@
|
|||
<a
|
||||
href="{{ system.url }}/issues"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{{localize "taf.misc.issues"}}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{{#if hasNewVersion}}
|
||||
<p>
|
||||
{{localize "taf.misc.new-version-available" version=newVersion}}
|
||||
</p>
|
||||
{{/if}}
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue