Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functionality to GUIMain to pull the readme from a specified URL in the mod. #56

Merged
merged 10 commits into from
Jul 4, 2023

Conversation

flpydsk
Copy link
Member

@flpydsk flpydsk commented Jul 1, 2023

allow readmes to be held in a git repo and read from ingame

@flpydsk flpydsk requested a review from Nagord July 1, 2023 09:37
@flpydsk flpydsk self-assigned this Jul 1, 2023
@flpydsk flpydsk added the enhancement New feature or request label Jul 1, 2023
@flpydsk
Copy link
Member Author

flpydsk commented Jul 1, 2023

I have things working the way I want. Had issues with async briefly where it would load the readme several times , but that is solved now so its merged back in to the netreadme branch.

@flpydsk
Copy link
Member Author

flpydsk commented Jul 1, 2023

Current:

  • Loads Readme from URL defined in Mod.ReadmeURL
  • Option in pulsar mod loader settings to auto pull the readme when you open the mod page
  • stores in KV by mod name
    To Do:
  • save/cache readme and only update on mod version change/manual reload.

@flpydsk
Copy link
Member Author

flpydsk commented Jul 2, 2023

This can pull a readme from a file in a url or from a file inside a zip with the same name as the mod.Name using mod.ReadmeURL => "file://readme.md"
mod.ReadmeURL => "https://example.com/readme.md"
All readmes are either loaded by pressing the readme buttion or on open of the mod page, no data is loaded prior to the user requesting it

Copy link
Member

@Nagord Nagord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems functional enough, although the new thread feels like it could be handled better.

Examining how readme pulls are made, we can add some extra safety. Right now, a new thread will be created every frame for as long as PMLConfig.AutoPullReadme is true and the readme text is false. I recommend creating a Boolean for whether a readme pull was requested and checking for that before creating a thread.

Additionally, if the button to load the readme is called, it'll display a label for 1 frame. The label will then disappear until the button is pushed again.

@flpydsk
Copy link
Member Author

flpydsk commented Jul 4, 2023

Given the discussion Ill make some changes

  • dict
  • ill move the threading inside the running check, so it does not even start a thread.
  • ill also add some bounding around the unzipping
    also the label only displays for one frame because the unzipping is quick and there is no special case for the button

@flpydsk
Copy link
Member Author

flpydsk commented Jul 4, 2023

Thread is now only called if Readme is empty and its not locked.
The dict is checked each frame when mod page is open, however its probably fine the way it is and caching the last mod and last readme seems overkill just to reduce the overhead for only when you are viewing the readme.
limit max file sizes for zipmods and for readmes
Moved to single dict
Added options to the GUI per below
image

@flpydsk flpydsk requested a review from Nagord July 4, 2023 09:27
Copy link
Member

@Nagord Nagord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine.

@Nagord Nagord merged commit 9cd19b5 into master Jul 4, 2023
@flpydsk flpydsk deleted the netreadme branch July 4, 2023 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants