aboutsummaryrefslogtreecommitdiff
path: root/src/utils.js
AgeCommit message (Collapse)Author
2022-02-03detection of installed mods, disabling buttonsGitExample
When a new mod has been installed through the browser UI it's button is changed from "Install" to "Re-Install" instantly. We also now disable modding related buttons when updating NS, or when installing mods. This should prevent issues.
2022-02-03ability to download from browserGitExample
This should work for all mods, assuming that all mods come packages the same, aka, in a Zip, with mods/<mod> in it. Which from what I know they do.
2022-01-18fixed random text in the middle of code0neGal
This was some Vim shenanigans (accidentally pressing "." after adding that text a little further up), at least that's my guess.
2022-01-17first draft on documentation/adding comments0neGal
Currently I've only added documentation in the utils.js file, however I'll add the other files later on, along with likely changing up the documentation in here.
2022-01-15fix wrong path.join()0neGal
2022-01-15fix error when R2Northstar/mods isn't created0neGal
2022-01-12feat: New UI (#26)Rémy Raes
* [chore] removing setsize mechanism * [feat] adding new html skeleton * [feat] adding games icon buttons * [feat] all icon buttons have same size * [fix] games container width varies between 95 and 120px * [feat] displaying bg image * [feat] each game has its own background image * [feat] adding content skeleton * [feat] window has no frame anymore * [feat] buttons show related content only * [feat] displaying viper release notes * [feat] game icons are vertically centered * [feat] background is a bit grayed out * [feat] adding some items to games menus * [feat] displaying games logos * [feat] adding content menu active item indicator * [fix] centering active item indicator * [feat] not displaying viper credits by default * [feat] viper categories can be browsed through via menu * [feat] adjusting hovering style of menu items * [feat] adding play button styles * [feat] adding missing vp sections * [feat] adding link styles * [fix] scaling down northstar logo * [feat] adding ns sections * [feat] fetching northstar release notes * [fix] release notes containers are scrollable * [feat] removing space between menu and some sections * [feat] loading vp+ns versions into interface * [chore] pushing version to 0.10.0 * [feat] play buttons launch games * [refactor] renaming vp releases fetching method * [feat] displaying an option to update northstar * [feat] message is displayed if ns is up-to-date * [feat] displaying ns download progress * [refactor] removing ns-updating and ns-updated events * [feat] adding UI translations * [fix] correctly displaying vp release notes * [refactor] removing useless code * [feat] adding Imply to credits for viper logo * [feat] loading titanfall version from gameversion.txt file * [feat] centering viper main section * [feat] adding custom scrollbars to release notes sections * [feat] disabling images drag * [feat] all external links are opened in default browser * [feat] formatting release notes with markdown converter * [feat] translating UI items * fixed backgrounds not being same size This would cause weird transitions. * new.css is now main.css, fixed colors and fonts * page indicator is now prettier We no longer use a character to render a circle, and it's no longer a circle, instead it's a line, we also now have a nice transition on it, both for fading in and out. * removed simplebar in favor of ::-webkit-scrollbar Almost everything we did with simplerbar could be done with native WebKit scollbar CSS, hence why we switched to it. * fixed uneven nav button margin * fixed formatting Single quotes to double quotes, spaces to tabs, etc etc... I also removed simplerbar properly... * removed unneeded consts Elements set with ID's can by default be referred to with their ID, aka: const element = document.getElementById("element"); Is useless as "element" will automatically refer to that element if theres no variable that overwrites it. * use release name over tag_name "Release vX.X.X" frankly looks better than "vX.X.X" * playBtn's now look nicer Slight transition on hover and click. * added pointer cursors to nav buttons and playBtn's Along with transitions to the nav buttons, because they look very good. * [fix] viper main section appears correctly on viper logo clicked * different opacity for inactive pages * removed "Roboto Mono", added normal "Roboto" * removed old HTML * fixed formatting in launcher.js * redesigned contentContainer's, and a lot more I also swapped around the Vanilla logo and Northstar logo to have the same size and the "Titanfall 2" text is in the same place on both images, allowing seamless transition when changing pages. I also completely redesigned displayContent(), it's now page() and doesn't revolve around a switch case. I'll likely do a similar thing with showVpSection() and showNsSection(), uniting them into one function that doesn't use switch cases. * added close button * fix game icons not being found * removed excess icons from assets folder * [feat] adding a br to french releases key * [feat] centering menu items * [feat] implementing requests cache for NS release notes * [feat] implementing cache for VP release notes * changed ttf2 to tf2 Along with that, I also renamed the northstar2.jpeg bg to just northstar.jpg, as all other background are .jpg * [fix] adjusting containers * [fix] adding some space between menu and content Since we have lots of space to use now, let's use it! This extra-space does not apply to release notes sections, which already takes all available screen space. * [feat] adding code style * [fix] window is draggable thanks to a drag bar on its top * [fix] drag bar height * [fix] all window is draggable * [fix] not disabling game buttons on ns update * [fix] disabled buttons cannot be clicked * [fix] displaying ns update downloading state on UI * [fix] typos * general improvements to the UI Launch buttons now have a nice gradient, a shadow and a better hover animation. The Titanfall logos are now also centered no matter the window size, so if in the future we decide to allow resizing the window that won't be a problem, or if you force the window to do it through some trickery, it'll also still show correctly. I also changed the default font weight to 500, some pieces of text looked very thin. * unified information and credits section * mods section should more or less look good now Still not complete done, I still wanna implement a drag and drop install, along with selecting whether you're installing a zip or folder. And also a warning when toggling or removing required mods... But generally this is the design I will go with. * added warnings for toggling/removing core mods * [feat] adding missing translations * [fix] typo in gui.mods.disabledtag french translation * re-added download progress * added section transitions * switched to npm module for markdown parsing * correcting some formatting, nothing special * active page button is now more obvious Co-authored-by: 0neGal <mail@0negal.com>
2022-01-11formatting, and localized logs0neGal
2022-01-11[refactor] adding translations for notification textsAlystrasz
2022-01-11[feat] sending a notification when an update is available during game sessionAlystrasz
2022-01-11[feat] update process is not launched if game is currently runningAlystrasz
2022-01-11[fix] not checking for NorthstarLauncher2.exe process anymoreAlystrasz
2022-01-10[feat] adding code to check if a tf2 process is runningAlystrasz
2022-01-10[refactor] renaming exec to runAlystrasz
2022-01-10[fix] not running auto-updates if gamepath is not setAlystrasz
2022-01-10[fix] not running auto-updates if viper.json does not existAlystrasz
2022-01-10[fix] checking for updates on viper launchRemy Raes
2022-01-08[feat] not checking for updates if settings.autoupdate is falseAlystrasz
2022-01-08[feat] checking every 15 minutes for new Northstar versionAlystrasz
2022-01-08mod support is disables if NS is not installed0neGal
2022-01-08fixed error if you ran --installmod without args0neGal
2022-01-08added cli arguments for mods0neGal
This adds both the arguments themselves, but also their entries in the man page and help page.
2022-01-08removed extra "})"0neGal
No clue why this is a here, or how it came to be.
2022-01-08Merge branch 'main' into mod-support0neGal
2022-01-07removed manual settings file write0neGal
Now using just saveSettings(), I think this line was overlooked when implementing the saveSettings() function.
2022-01-07fix: Game path check (#29)Rémy Raes
* [feat] adding methods signature to alert when selected game path is falsy * [feat] a game path is valid if it contains 'Titanfall2.exe' file * [feat] adding translations for wrong gamepath key * [feat] if a wrong path has been selected, ask for it again * formatting and removing useless function Given we only use checkGamePath() once there's no need to even have a function for it. Co-authored-by: 0neGal <mail@0negal.com>
2022-01-07fix: Rate limit (#27)Rémy Raes
* [chore] adding electron-fetch dependency * [feat] adding requests module skeleton * [feat] not doing any http request to get latest ns version if data is fresh * [fix] data is considered fresh if less than 5 minutes old * [feat] adding requests.getLatestNsVersionLink implementation * [refactor] fully using requests module (with associated cache) * [docs] adding documentation to requests module * [refactor] adding a key to get nsLatestRelease cache results * [chore] removing request deprecated dependency * [feat] using follow-redirects instead of electron-fetch * [chore] removing electron-fetch dependency * fixed formatting Single quotes to double, proper textwidth for comments, and proper comment style, the usual... Nothing special here... * fixed wrong location for requests.json We don't want to clutter people's config folder, hence we should use the cache folder instead... Co-authored-by: 0neGal <mail@0negal.com>
2022-01-05Merge branch 'main' of 0neGal/viper into mod-support0neGal
2022-01-04fix: No game path (#24)Rémy Raes
* [refactor] moving main.setPath listener outside start method * [refactor] setpath tells if game path is set or not * newpath event tells if game path dialog is successful or not * [feat] main window will not show if path is not set * [feat] viper displays a dialog and exits if no game path was prompted * [fix] viper prompts for game path if viper.json:gamepath is not set * [feat] translating gui.gamepath.must key * code cleanup fixing single quotes and alike * fix gui.gamepath.must message Co-authored-by: 0neGal <mail@0negal.com>
2022-01-03fixed error when disabled isn't created0neGal
2022-01-03fixed missingpath localization0neGal
2022-01-03Merge branch 'main' of 0neGal/viper into mod-support0neGal
2022-01-03download progress for NS0neGal
However in megabytes, and I don't know math very well, I just know (bytes / 1024 / 1024) gives megabytes, if you know a better simpler way to convert this make a PR, please...
2022-01-03we're now able to install archived mods0neGal
Lovely, only issue is for some reason both on Windows and Linux file dialogs can't select both directories and files, so either it's a folder or it's an archive, not both. So I guess we need to make some way to select it...
2022-01-03installing mods from folders got a lil easier0neGal
If a mod decided to put their actual mod files inside a folder inside a folder it'll search sub folders to try and find them and usually it's able to install it. Meaning, if instead of the mod being structured as such: mod/ mod.json other files ... It is structured as such: folder/ mod/ mod.json other files ... This will be very useful for zip files... As some people tend to archive a folder and not make an archive with the files in it. Leading to the above structure...
2022-01-03fully working GUI functionality0neGal
Smoothly updates and works flawlessly, the only thing that really needs improvements is the design and on top of that installing mods from a Zip file over folder.
2022-01-02toggling, removing and installing mods works0neGal
Mostly, the installing part needs a bit more look at, to support archives and different layouts for the mod. Such as searching through an archive to find the right folder because some mods don't use a proper layout. I also somewhat mitigated the whole issue of JSON files not being formatted properly by the mod developer (please just fix your formatting, I beg you.) by simply assigning the absolute basics, however we can't know the versions of the mods. I am not going to go out of my way to write code which can parse a file that wasn't made to be parsed because whoever wrote it doesn't know what a JSON file is made of. Simply not happening. I also added a few locatiolization related things, along with more info for --mods, so besides the normal counter for "Installed mods" you also have "Enabled mods" and "Disabled mods", very useful. The GUI also has a new added "Disabled" tag to mods that are disabled, however this is a temporary, it looks bad and I don't want it in release, I just needed a way to distinquish when testing. Because you can now also enable and disable mods, mods.list() gives back an Object that goes more or less something like: {all: ..., enabled: ..., disabled: ... }, take your guesses as to what everything means, you might even get it in the first try.
2022-01-02Merge branch 'main' of 0neGal/viper into mod-support0neGal
2022-01-01chore: Auto updating (#16)Rémy Raes
* [chore] adding electron-updater dependency * [feat] adding auto-updating mechanism * [chore] setting package version to v0.8.0 * [fix] restoring original repo URL * [docs] adding some documentation about publishing new releases * [chore] adding publish:windows command * [docs] updating publish instructions with new publish command * [chore] adding publish:linux command * [docs] updating publish instructions * --updatevp, and option to disable auto updates If you want you can set "autoupdates" to false in your config, no GUI tools to do this yet. For the CLI auto updates is off by default and you'll have to use --updatevp. I also removed the snap package, tho whether this stays as a change is still to be discussed. And with the new option I updated the help menu, the man page and everything along else that needs it. * removed "soon" parts of README for auto-updates * [feat] adding French translation for cli.help.updatevp key * confirmation for restarting the app Now instead of automatically updating and restarting the app, which may be slightly confusing to some users, (the app opens then closes and then opens), it now asks whether you want to restart and open the new version. If you say no, instead next time you launch it, it'll be on the new version. If you want to completely disable updates you can disable it in the viper.json file... * [feat] adding French translation for gui.update.available key * added configuration instruction in README Co-authored-by: 0neGal <mail@0negal.com>
2021-12-31Merge branch 'main' of 0neGal/viper into mod-support0neGal
2021-12-30first-ish draft of the mod UI and utils0neGal
2021-12-30Merge branch 'main' into feat/version-indicator0neGal
2021-12-30buttons now disable when updating, and app logs0neGal
The buttons in the GUI disable whilst you're updating Northstar and potentionally doing other things in the future, I also added a way to log things in the app, albeit it just prints it in the "Welcome to Viper!" part of the app, which is just fine. I also added all the needed language strings for the GUI logs and removed "gui.missinggamepath" as we use it for both the CLI and GUI even tho "general.missinggamepath" exists, and so we now use the general one for both, as the messages are the same.
2021-12-30version now refreshes, fixed and renamed stuff0neGal
The version now refreshes when you update/install Northstar, I renamed vpVersion/nsVersion to just vpversion/nsversion and getInstalledVersion() to getNSVersion(), removed uses of getElementById() with just the ID. I also added English localization. The versions text color is now bound by a CSS variable (we may use it in the future again). I'm also not sure what the point of `style="white-space: nowrap;"` was, as I don't see much of a difference? Rather instead use `<nobr>` in the lang file if needed. Besides that I did tiny code cleanup.
2021-12-30[feat] exporting utils.getInstalledVersion methodAlystrasz
2021-12-29cli is now fully localized0neGal
That is, it's now using our localization module...
2021-12-29Merge branch 'main' of 0neGal/viper into localization0neGal
2021-12-29uses navigator.language to determine language0neGal
2021-12-29Merge pull request #6 from Alystrasz/feat/updates-downloading0neGal
feat: Updates downloading
2021-12-29lil touch up on the log messages0neGal