Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
bacbfad
Updated node version in release.yml
ebkr Feb 26, 2025
addce4b
Fix profile import silently leaving some mods uninstalled
anttimaki Feb 27, 2025
08efbaf
Merge pull request #1647 from ebkr/fix-partial-profile-imports
anttimaki Feb 27, 2025
2427a1c
Add game: Gang Beasts
VilppeRiskidev Feb 26, 2025
7e5442e
Merge pull request #1645 from ebkr/add-game-gang-beasts
anttimaki Feb 27, 2025
ef2bf92
Add R.E.P.O.
Oksamies Feb 27, 2025
c080809
Merge pull request #1648 from thunderstore-io/repo
anttimaki Feb 27, 2025
b5b5258
Add Zort
Oksamies Mar 6, 2025
86af6b2
Added dispatch to update API cache in background if cache was already…
ebkr Mar 8, 2025
92ead81
Added comment to explain syncPackageList dispatch
ebkr Mar 10, 2025
9b81c4c
Merge pull request #1657 from ebkr/refresh-ts-list-after-cache-load
ebkr Mar 10, 2025
7f743a5
Updated CHANGELOG and versions
ebkr Mar 10, 2025
59c1fe5
Merge pull request #1659 from ebkr/release-3.1.57
ebkr Mar 10, 2025
c1df6a9
Fix the typing of package's donation link
anttimaki Mar 11, 2025
c048dc4
Add DonateIconButton component to reduce repetition
anttimaki Mar 11, 2025
6ec1be1
Only filter out versions when not dealing with modpacks
VilppeRiskidev Feb 28, 2025
91715ec
Merge pull request #1654 from thunderstore-io/add-zort
anttimaki Mar 11, 2025
6f6d82a
Update game cover images for Gang Beasts, R.E.P.O., and Zort
anttimaki Mar 10, 2025
3551f67
Merge pull request #1664 from ebkr/game-assets
anttimaki Mar 11, 2025
cc04cd1
Add game: Disco Elysium
VilppeRiskidev Feb 18, 2025
3b700cf
Add game: Odd Remedy
VilppeRiskidev Mar 3, 2025
e91bbba
Add 3 new games: Dusk, Monster Train 2 and My Dream Setup
VilppeRiskidev Mar 10, 2025
f204212
Merge pull request #1638 from ebkr/add-game-disco-elysium
anttimaki Mar 12, 2025
e813603
Merge pull request #1652 from ebkr/add-game-odd-remedy
anttimaki Mar 12, 2025
6a6b265
Merge pull request #1658 from ebkr/add-dusk-mds-mt2
anttimaki Mar 12, 2025
ce2ccd7
Merge pull request #1649 from ebkr/only-filter-modpacks
anttimaki Mar 12, 2025
22c4a7a
Merge pull request #1662 from ebkr/undefined-donate-link
anttimaki Mar 12, 2025
eecaa5e
Remove default value definition to avoid causing rerendering
anttimaki Mar 12, 2025
a3a5bdd
Merge pull request #1665 from ebkr/donateiconbutton-fix
anttimaki Mar 12, 2025
628cc8a
Show explanation in associations modal when a mod has no dependencies…
VilppeRiskidev Mar 13, 2025
f1c60f4
Add a getter isModListOutdated
VilppeRiskidev Feb 11, 2025
cbb0731
Track error status whwn mod list is partially loaded
VilppeRiskidev Feb 12, 2025
4034ab7
Prevent doing mod list refresh while there are active mod downloads
VilppeRiskidev Feb 24, 2025
e4aa39f
Display information about mod list updating being prevented while the…
VilppeRiskidev Feb 26, 2025
ee98e1e
Display correct info about refresing the online mod list in SettingsView
VilppeRiskidev Mar 13, 2025
c059419
Merge pull request #1667 from ebkr/empty-associated-mods
anttimaki Mar 14, 2025
ca7e0fc
Merge pull request #1633 from ebkr/status-indicator-data
anttimaki Mar 14, 2025
d8d7846
Merge pull request #1646 from ebkr/mod-list-update-prevent-info
anttimaki Mar 14, 2025
02c3091
Sync partial profile changes to disk in case mod (un)install fails
anttimaki Mar 14, 2025
67e38a9
Update GameInstructionParser.ts
GoBoopADog Mar 16, 2025
44caec4
Merge pull request #1669 from ebkr/uninstall-mod-reload-list-v2
anttimaki Mar 17, 2025
c66e59f
Automatically refresh the local mod list when, during a profile impor…
VilppeRiskidev Mar 6, 2025
b16986d
Show refreshing status on the UI when automatically refreshing
VilppeRiskidev Mar 6, 2025
e289606
Fix retrying the profile import and Improve displaying information ab…
VilppeRiskidev Mar 6, 2025
05bf2fd
Merge pull request #1655 from ebkr/profile-import-auto-refresh
anttimaki Mar 17, 2025
7b35c6f
Merge pull request #1671 from GoBoopADog/develop
anttimaki Mar 18, 2025
738ba2f
Update mod list refresh status in SplashMixin
anttimaki Mar 18, 2025
49eb82c
Merge pull request #1672 from ebkr/splash-update-status
anttimaki Mar 18, 2025
0f54203
Change how profile import wizard waits for online mod list refresh
anttimaki Mar 18, 2025
15e3f08
Merge pull request #1673 from ebkr/profile-import-refresh-waiting
anttimaki Mar 18, 2025
12fc044
Show if active mod downloads are blocking a profile import
anttimaki Mar 18, 2025
a4d2fe9
Merge pull request #1674 from ebkr/profile-import-mod-downloads
anttimaki Mar 18, 2025
3b558ea
Fix download progress getting stuck
VilppeRiskidev Mar 18, 2025
929c6f5
Merge pull request #1675 from ebkr/fix-download-progress-stuck
anttimaki Mar 20, 2025
f775292
Fix state drift of ignoreCache setting
anttimaki Mar 20, 2025
49df270
Merge pull request #1677 from ebkr/ignore-cache-vuex
anttimaki Mar 20, 2025
8cabee6
Add installation tracking to mod installation when it's initiated by …
VilppeRiskidev Mar 21, 2025
dbf8634
Merge pull request #1678 from ebkr/track-installation-progress-via-link
anttimaki Mar 26, 2025
90332af
Fix focus styles for buttons
VilppeRiskidev Mar 27, 2025
de9fd1e
Add Schedule I
Oksamies Mar 27, 2025
ef5ac0b
Merge pull request #1685 from thunderstore-io/add-schedule-i
anttimaki Mar 28, 2025
3596fff
Fix game cover image definition
anttimaki Mar 28, 2025
ffdf76c
Merge pull request #1686 from ebkr/fix-image-format
anttimaki Mar 28, 2025
0e8902f
Merge pull request #1684 from ebkr/fix-button-focus-styles
anttimaki Mar 28, 2025
2cea8dd
add hades 2 egs
xiaoxiao921 Mar 31, 2025
0b0244a
Merge pull request #1688 from xiaoxiao921/addhades2egs
anttimaki Mar 31, 2025
cc90191
Add 4 new games
VilppeRiskidev Mar 31, 2025
41f0b5e
Update Schedule I cover image
anttimaki Apr 1, 2025
f1081e0
Add a button to remove an inactive download from the list in Download…
VilppeRiskidev Mar 25, 2025
3eecfce
Improve the style of the action button in DownloadMonitor's item
VilppeRiskidev Apr 1, 2025
06c67a2
Merge pull request #1682 from ebkr/clear-inactive-downloads
anttimaki Apr 2, 2025
e907f8f
Add a button which clears all inactive downloads form the list in Dow…
VilppeRiskidev Mar 25, 2025
131cd20
Merge pull request #1683 from ebkr/clear-inactive-downloads-all
anttimaki Apr 2, 2025
ab0d1c5
Merge pull request #1689 from ebkr/add-4-games
anttimaki Apr 2, 2025
4c30164
Merge pull request #1690 from ebkr/schedule-cover
anttimaki Apr 2, 2025
aa2dd84
Add a checkbox confirmation to ImportProfileModal when partially impo…
VilppeRiskidev Apr 2, 2025
9a77a78
Fix a typo in GameManager
VilppeRiskidev Apr 4, 2025
79fe965
Merge pull request #1693 from ebkr/fix-white-knuckle-typo
anttimaki Apr 7, 2025
8a50b25
Merge pull request #1691 from ebkr/partial-import-checkbox-confirmation
anttimaki Apr 7, 2025
30266a0
Remove the promise and instead just throw the errors in installModAft…
VilppeRiskidev Apr 7, 2025
93156db
Use throwForR2Error in one more place
VilppeRiskidev Apr 8, 2025
4f49499
Use ThunderstoreCombo instead of separate mod and version in Download…
VilppeRiskidev Apr 7, 2025
b73ddf8
Use ImmutableProfile instead of Profile in downloadSpesific and insta…
VilppeRiskidev Apr 8, 2025
818bf73
Remove a check which made BepInEx package not be uninstalled before
VilppeRiskidev Apr 7, 2025
b46f3f6
Perform some cleanup for installModAfterDownload
VilppeRiskidev Apr 7, 2025
c266674
Relocate installModAfterDownload to DownloadModule
VilppeRiskidev Apr 8, 2025
519a593
Remove unused imports
anttimaki Apr 9, 2025
ec4e735
Merge pull request #1697 from ebkr/installmodafterdownload-remove-pro…
anttimaki Apr 9, 2025
ae3e31c
Merge pull request #1698 from ebkr/installmodafterdownload-arguments
anttimaki Apr 9, 2025
d923fd3
Merge pull request #1699 from ebkr/installmodafterdownload-remove-bep…
anttimaki Apr 9, 2025
dd8a2c9
Merge pull request #1700 from ebkr/installmodafterdownload-cleanup
anttimaki Apr 9, 2025
df96604
Merge pull request #1702 from ebkr/installmodafterdownload-relocate
anttimaki Apr 9, 2025
fea067b
Export mod loader mappings from TS module
MythicManiac Apr 9, 2025
09523e5
Merge pull request #1704 from thunderstore-io/export-modloader-mappings
MythicManiac Apr 9, 2025
d9914ec
Remove Promises and other unnecessary waiting
VilppeRiskidev Apr 10, 2025
cbfec78
Separate downloadSpecific into downloadAndInstallSpecific and install…
VilppeRiskidev Apr 10, 2025
d310b92
Move downloadProgressCallback and addSolutionsToError away from UI co…
VilppeRiskidev Apr 10, 2025
501dc3e
Move installSpecific away from UI component and rename the dispatches
VilppeRiskidev Apr 10, 2025
cc4d610
Perform some cleanup for stuff related to downloadAndInstallSpecific
VilppeRiskidev Apr 11, 2025
7ad9481
Update the cover images for R.E.P.O. and Gatekeeper
VilppeRiskidev Apr 11, 2025
b5a8f9f
Merge pull request #1711 from ebkr/update-cover-images
anttimaki Apr 14, 2025
1eed662
Move downloadAndInstallSpecific away from the UI component
VilppeRiskidev Apr 11, 2025
76bc8ad
Improve mod installing via a link
VilppeRiskidev Apr 14, 2025
841c401
Merge pull request #1705 from ebkr/downloadspecific-remove-promises
anttimaki Apr 15, 2025
936e125
Merge pull request #1706 from ebkr/downloadspecific-separate-installs…
anttimaki Apr 15, 2025
27c4757
Merge pull request #1707 from ebkr/move-downloadprogresscallback-and-…
anttimaki Apr 15, 2025
93ddea0
Merge pull request #1708 from ebkr/move-installspecific
anttimaki Apr 15, 2025
511ce37
Merge pull request #1709 from ebkr/downloadspecific-cleanup
anttimaki Apr 15, 2025
b35d3a9
Merge pull request #1710 from ebkr/move-downloadandinstallspecific
anttimaki Apr 15, 2025
6daf1f3
Merge pull request #1714 from ebkr/mod-install-via-link-route-filter
anttimaki Apr 15, 2025
9d9e429
Add 3 new games
VilppeRiskidev Apr 15, 2025
ed04ef7
Merge pull request #1715 from ebkr/add-3-new-games
anttimaki Apr 16, 2025
abb68ec
Add support for Aska
anttimaki Apr 16, 2025
66e45c8
Merge pull request #1716 from ebkr/add-aska
anttimaki Apr 16, 2025
7a98f1d
Updated versions and README
ebkr Apr 17, 2025
9e6aadc
Merge pull request #1727 from ebkr/release-3.1.58
ebkr Apr 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: actions/setup-node@v4
with:
# The talk on the street says this might be a good version for building.
node-version: 19.2.0
node-version: 20.11.0
cache: yarn

- name: Install Yarn dependencies
Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
### 3.1.58
#### Games added
- Schedule 1
- Zort
- Disco Elysium
- Odd Remedy
- Dusk
- Monster Train 2
- My Dream Setup
- Hades 2 (@xiaoxiao921)
- Gatekeeper
- Pulsar: Lost Colony
- Songs of Conquest
- White Knuckle
- ENA: Dream BBQ
- Human Fall Flat
- Magicite
- ASKA

### 3.1.57
#### Games added
- R.E.P.O
- Gang Beasts

#### Fixes
- Cached Thunderstore mod list refresh occurs immediately in the background again.
- Prevented certain mods from not being included in profile imports if the cache is not up-to-date.

### 3.1.56
#### Games added
- Subterror
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "r2modman",
"version": "3.1.56",
"version": "3.1.58",
"description": "A simple and easy to use mod manager for many games using Thunderstore.",
"productName": "r2modman",
"author": "ebkr",
Expand Down
1 change: 1 addition & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default class App extends mixins(UtilityMixin) {
const settings: ManagerSettings = await this.$store.dispatch('resetActiveGame');

this.hookBackgroundUpdateThunderstoreModList();
this.hookModInstallingViaProtocol();
await this.checkCdnConnection();

InstallationRuleApplicator.apply();
Expand Down
2 changes: 1 addition & 1 deletion src/_managerinf/ManagerInformation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import VersionNumber from '../model/VersionNumber';

export default class ManagerInformation {
public static VERSION: VersionNumber = new VersionNumber('3.1.56');
public static VERSION: VersionNumber = new VersionNumber('3.1.58');
public static IS_PORTABLE: boolean = false;
public static APP_NAME: string = "r2modman";
}
Binary file added src/assets/images/game_selection/ASKA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/game_selection/DUSK.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/game_selection/GangBeasts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/game_selection/Gatekeeper.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/game_selection/Magicite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/game_selection/MyDreamSetup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/game_selection/OddRemedy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/game_selection/REPO.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/game_selection/ScheduleI.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/game_selection/WhiteKnuckle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/game_selection/zort.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 8 additions & 3 deletions src/components/ModListUpdateBanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,18 @@ export default class ModListUpdateBanner extends Vue {
{{ $store.state.tsMods.thunderstoreModListUpdateStatus }}
</span>
<span v-else-if="updateError">
Error updating the mod list.
Error refreshing the mod list.
<a @click="openErrorModal">View error details</a>.
<br />
The manager will keep trying to update the mod list in the background.
The manager will keep trying to refresh the mod list in the background.
</span>
<span v-else-if="$store.getters['download/activeDownloadCount'] > 0">
An error occurred when refreshing the mod list from Thunderstore.<br />
However, the mod list can't be refreshed while the are mod downloads in progress.<br />
Please wait for the downloads to finish before continuing.
</span>
<span v-else>
An error occurred when updating the mod list from Thunderstore.
An error occurred when refreshing the mod list from Thunderstore.
Would you like to
<a @click="updateModList">try again now</a>?
</span>
Expand Down
5 changes: 3 additions & 2 deletions src/components/buttons/DonateButton.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<Link :url="mod.getDonationLink()"
:target="'external'"
<Link v-if="mod && mod.getDonationLink()"
:url="mod.getDonationLink()"
target="external"
class="card-footer-item"
v-tooltip.left="{content: 'Donate to the mod author', distance: 0}">
<i class='fas fa-heart margin-right margin-right--half-width'></i>
Expand Down
30 changes: 30 additions & 0 deletions src/components/buttons/DonateIconButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<template>
<span v-if="mod && mod.getDonationLink() && extraRenderCondition" class="card-header-icon">
<Link :url="mod.getDonationLink()" target="external" tag="span">
<i class="fas fa-heart" v-tooltip.left="'Donate to the mod author'"></i>
</Link>
</span>
</template>

<script lang="ts">

import { Component, Prop, Vue } from 'vue-property-decorator';
import ThunderstoreMod from '../../model/ThunderstoreMod';
import { Link } from '../../components/all';

@Component({
components: {
Link
}
})
export default class DonateIconButton extends Vue {

@Prop({required: true})
mod: ThunderstoreMod | undefined;

@Prop({default: true})
extraRenderCondition!: boolean;

}

</script>
67 changes: 13 additions & 54 deletions src/components/mixins/DownloadMixin.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<script lang='ts'>
import Vue from 'vue';
import Component from 'vue-class-component';
import { Store } from "vuex";

import StatusEnum from "../../model/enums/StatusEnum";
import R2Error, { throwForR2Error } from "../../model/errors/R2Error";
import Game from "../../model/game/Game";
import ManifestV2 from "../../model/ManifestV2";
import Profile, { ImmutableProfile } from "../../model/Profile";
import ThunderstoreCombo from "../../model/ThunderstoreCombo";
import ThunderstoreMod from "../../model/ThunderstoreMod";
Expand Down Expand Up @@ -34,11 +31,6 @@ export default class DownloadMixin extends Vue {
return this.$store.state.modals.isDownloadModModalOpen;
}

get ignoreCache(): boolean {
const settings = this.$store.getters['settings'];
return settings.getContext().global.ignoreCache;
}

get thunderstoreMod(): ThunderstoreMod | null {
return this.$store.state.modals.downloadModModalMod;
}
Expand All @@ -56,59 +48,26 @@ export default class DownloadMixin extends Vue {
}
}

static downloadProgressCallback(
store: Store<any>,
assignId: number,
downloadProgress: number,
modName: string,
status: number,
err: R2Error | null,
closeModProgressModal?: () => void,
) {
if (status === StatusEnum.FAILURE) {
if (closeModProgressModal !== undefined) {
closeModProgressModal();
}
store.commit('download/updateDownload', {assignId, failed: true});
if (err !== null) {
DownloadMixin.addSolutionsToError(err);
throw err;
}
} else if (status === StatusEnum.PENDING || status === StatusEnum.SUCCESS) {
store.commit('download/updateDownload', {assignId, modName, downloadProgress});
}
}

async installModsAndResolveConflicts(
downloadedMods: ThunderstoreCombo[],
profile: ImmutableProfile,
assignId: number
): Promise<void> {
await ProfileModList.requestLock(async () => {
const modList: ManifestV2[] = await installModsToProfile(downloadedMods, profile, undefined,(status, modName, installProgress) => {
this.$store.commit('download/updateDownload', {assignId, modName, installProgress});
});
await this.$store.dispatch('profile/updateModList', modList);
throwForR2Error(await ConflictManagementProvider.instance.resolveConflicts(modList, profile));
try {
const modList = await installModsToProfile(downloadedMods, profile, undefined, (status, modName, installProgress) => {
this.$store.commit('download/updateDownload', {assignId, modName, installProgress});
});
throwForR2Error(await ConflictManagementProvider.instance.resolveConflicts(modList, profile));
} catch (e) {
throw e;
} finally {
// Update the mod list shown in the UI. installModsToProfile()
// attempted to save partial changes to disk even if some of
// the (un)installations failed.
this.$store.dispatch('profile/tryLoadModListFromDisk');
}
});
}

static addSolutionsToError(err: R2Error): void {
// Sanity check typing.
if (!(err instanceof R2Error)) {
return;
}

if (
err.name.includes("Failed to download mod") ||
err.name.includes("System.Net.WebException")
) {
err.solution = "Try toggling the preferred Thunderstore CDN in the settings";
}

if (err.message.includes("System.IO.PathTooLongException")) {
err.solution = 'Using "Change data folder" option in the settings to select a shorter path might solve the issue';
}
}
}
</script>
8 changes: 8 additions & 0 deletions src/components/mixins/SplashMixin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default class SplashMixin extends Vue {

// Get the list of Thunderstore mods from local cache or API.
async _getThunderstoreMods() {
this.$store.commit('tsMods/startThunderstoreModListUpdate');
const hasPriorCache = await this.doesGameHaveLocalCache();

if (!hasPriorCache) {
Expand All @@ -49,6 +50,13 @@ export default class SplashMixin extends Vue {
}

await this.triggerStoreModListUpdate();
this.$store.commit('tsMods/finishThunderstoreModListUpdate');

if (hasPriorCache) {
// We want this to trigger in the background to ensure that the user gets an up-to-date modlist as soon as possible.
this.$store.dispatch('tsMods/syncPackageList');
}

await this.moveToNextScreen();
}

Expand Down
48 changes: 48 additions & 0 deletions src/components/mixins/UtilityMixin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,66 @@
import Vue from 'vue';
import Component from 'vue-class-component';

import Profile from '../../model/Profile';
import R2Error from '../../model/errors/R2Error';
import ThunderstoreCombo from '../../model/ThunderstoreCombo';
import CdnProvider from '../../providers/generic/connection/CdnProvider';
import InteractionProvider from '../../providers/ror2/system/InteractionProvider';
import { LogSeverity } from '../../providers/ror2/logging/LoggerProvider';
import ProfileModList from '../../r2mm/mods/ProfileModList';

@Component
export default class UtilityMixin extends Vue {
readonly REFRESH_INTERVAL = 5 * 60 * 1000;
private tsBackgroundRefreshFailed = false;

get profile(): Profile {
return this.$store.getters['profile/activeProfile'];
};

hookBackgroundUpdateThunderstoreModList() {
setInterval(this.backgroundRefreshThunderstoreModList, this.REFRESH_INTERVAL);
}

hookModInstallingViaProtocol() {
InteractionProvider.instance.hookModInstallProtocol(async (protocolUrl) => {
const exemptRoutes = ["index", "splash", "profiles"];

if (this.$route.name && exemptRoutes.includes(this.$route.name)) {
this.$store.commit('error/handleError', {
error: new R2Error(
"Unable to install mod(s)",
"Mod installation via a link is not possible when a game and a profile are not selected",
"Please select a game and a profile before attempting to install a mod via a link."
),
severity: LogSeverity.ACTION_STOPPED
});
return;
}

const game = this.$store.state.activeGame;
const combo: ThunderstoreCombo | R2Error = await ThunderstoreCombo.fromProtocol(protocolUrl, game);
if (combo instanceof R2Error) {
this.$store.commit('error/handleError', {
error: combo,
severity: LogSeverity.ACTION_STOPPED
});
return;
}

try {
await this.$store.dispatch('download/downloadAndInstallSpecific', {profile: this.profile.asImmutableProfile(), combo});
const modList = await ProfileModList.getModList(this.profile.asImmutableProfile());
if (modList instanceof R2Error) {
throw modList;
}
await this.$store.dispatch('profile/updateModList', modList);
} catch (err) {
this.$store.commit('error/handleError', R2Error.fromThrownValue(err));
}
});
}

/**
* Periodically refresh the Thunderstore mod list in the background.
*
Expand Down
Loading
Loading