diff --git a/dev/hooks/renderSettings.mjs b/dev/hooks/renderSettings.mjs index 2db8c21..ad11762 100644 --- a/dev/hooks/renderSettings.mjs +++ b/dev/hooks/renderSettings.mjs @@ -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(); diff --git a/langs/en-ca.json b/langs/en-ca.json index 908a714..43dcbb0 100644 --- a/langs/en-ca.json +++ b/langs/en-ca.json @@ -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." } } diff --git a/module/apps/overrides/TAFSettingsSidebar.mjs b/module/apps/overrides/TAFSettingsSidebar.mjs index e82e64d..b33bbb8 100644 --- a/module/apps/overrides/TAFSettingsSidebar.mjs +++ b/module/apps/overrides/TAFSettingsSidebar.mjs @@ -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`); diff --git a/module/hooks/init.mjs b/module/hooks/init.mjs index 60a12a5..b06467e 100644 --- a/module/hooks/init.mjs +++ b/module/hooks/init.mjs @@ -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(); diff --git a/module/hooks/ready.mjs b/module/hooks/ready.mjs index 6a5141d..2a8bf39 100644 --- a/module/hooks/ready.mjs +++ b/module/hooks/ready.mjs @@ -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(); }); diff --git a/module/hooks/renderSettingsConfig.mjs b/module/hooks/renderSettingsConfig.mjs index d488af3..a75c55c 100644 --- a/module/hooks/renderSettingsConfig.mjs +++ b/module/hooks/renderSettingsConfig.mjs @@ -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`); diff --git a/module/utils/ReleaseChannels.mjs b/module/utils/ReleaseChannels.mjs deleted file mode 100644 index aa6588b..0000000 --- a/module/utils/ReleaseChannels.mjs +++ /dev/null @@ -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`, - }); -}; diff --git a/styles/Apps/TAFSettingsSidebar.css b/styles/Apps/TAFSettingsSidebar.css index 4e6d034..010d6b4 100644 --- a/styles/Apps/TAFSettingsSidebar.css +++ b/styles/Apps/TAFSettingsSidebar.css @@ -26,10 +26,4 @@ margin: 0; } } - - p { - text-align: center; - font-size: small; - margin: 0; - } } diff --git a/styles/main.css b/styles/main.css index e6ae9f9..682b25d 100644 --- a/styles/main.css +++ b/styles/main.css @@ -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); diff --git a/styles/misc.css b/styles/misc.css deleted file mode 100644 index 061bcf5..0000000 --- a/styles/misc.css +++ /dev/null @@ -1,7 +0,0 @@ -.taf-chat-version-notif { - h2 { - font-family: var(--font-body); - font-size: 1.5rem; - margin: 0; - } -} diff --git a/system.json b/system.json index 041ee0a..22a301f 100644 --- a/system.json +++ b/system.json @@ -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"] diff --git a/templates/new-version-message.hbs b/templates/new-version-message.hbs deleted file mode 100644 index ff11bc0..0000000 --- a/templates/new-version-message.hbs +++ /dev/null @@ -1,17 +0,0 @@ -
-

- {{ system.title }} - {{ release.tag_name }} -

-

- A new {{ifThen release.prerelease "beta" ""}} version of {{ system.title }} has been released. -

- - Release Notes - -
diff --git a/templates/settings-sidebar-addition.hbs b/templates/settings-sidebar-addition.hbs index 699bb67..71fed2b 100644 --- a/templates/settings-sidebar-addition.hbs +++ b/templates/settings-sidebar-addition.hbs @@ -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 @@ {{localize "taf.misc.releases"}} @@ -30,7 +30,7 @@ {{localize "taf.misc.wiki"}} @@ -39,15 +39,10 @@ {{localize "taf.misc.issues"}} - {{#if hasNewVersion}} -

- {{localize "taf.misc.new-version-available" version=newVersion}} -

- {{/if}}