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

Run Minetest update checker on startup #7629

Merged
merged 5 commits into from
Aug 2, 2022

Conversation

SmallJoker
Copy link
Member

@SmallJoker SmallJoker commented Aug 8, 2018

However, the version checking is not optimal (relies on MINOR.MAJOR.PATCH) and GitHub seems to limit the API page calls (source). core.get_version should probably also be extended by a is_dev_build field to get around the ugly detection.

See #7629 (comment) for the current status and testing instructions.

@SmallJoker SmallJoker added Feature ✨ PRs that add or enhance a feature @ Mainmenu Discussion Issues meant for discussion of one or more proposals labels Aug 8, 2018
@rubenwardy
Copy link
Member

rubenwardy commented Aug 8, 2018

This, unfortunately, doesn't help with the biggest offender - Ubuntu. I've heard their policy was to remove update notifications and such from programs, but I can't find a citation for this (although I have seen one in firefox). Maybe they won't notice? :D

src/defaultsettings.cpp Outdated Show resolved Hide resolved
@ClobberXD
Copy link
Contributor

It'd be nice if the update check interval can be selected from a pre-defined set of choices like so

  • 1 day
  • 1 week
  • 1 month

@Calinou
Copy link
Member

Calinou commented Aug 9, 2018

This, unfortunately, doesn't help with the biggest offender - Ubuntu. I've heard their policy was to remove update notifications and such from programs, but I can't find a citation for this (although I have seen one in firefox). Maybe they won't notice? :D

That is indeed the policy of most distributions (including Debian and Ubuntu). It makes sense from their point of view, as users are not supposed to download Minetest directly from minetest.net according to them.

It'd be nice if the update check interval can be selected from a pre-defined set of choices like so

Is it really necessary to add one more configuration option just for this? We have a lot of them already. I think it would be enough to have a single boolean that controls whether updates should be checked daily.

@rubenwardy
Copy link
Member

That is indeed the policy of most distributions (including Debian and Ubuntu). It makes sense from their point of view, as users are not supposed to download Minetest directly from minetest.net according to them.

It would be nice if they also didn't provide an outdated version of a networked program :/

@ClobberXD
Copy link
Contributor

Is it really necessary to add one more configuration option just for this? We have a lot of them already.

I feel that the user should have control over how often MT checks for updates, and I don't think one extra drop-down would do any harm. :)

@rubenwardy
Copy link
Member

rubenwardy commented Aug 9, 2018

I don't think there is a need for the setting, personally. It adds more complexity and more settings is more things to test

@nerzhul
Copy link
Member

nerzhul commented Aug 9, 2018

Just use the github last release API instead of full release API:

#7629

@rubenwardy
Copy link
Member

We should not rely on the GitHub API as we may not use it forever. We could use the Github API in Jekyll to automatically make a JSON file with the latest release, this would be future proof

@Fixer-007
Copy link
Contributor

"was found" somewhere in the dungeons of the internet?

@@ -22,7 +22,7 @@ local function version_info_formspec(data)
return (
"size[9,4.5,true]" ..
"textarea[0.5,0.5;8.5,3;;" ..
fgettext("A new Minetest version was found!") .. ";" ..
fgettext("New Minetest version is available") .. ";" ..
Copy link
Contributor

Choose a reason for hiding this comment

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

"A new Minetest version..." maybe? Sounds better and more like a full sentence... :)

@orwell96
Copy link
Contributor

The "never notify me again" tickbox is a bit misleading IMO, it should read "don't notify me on future updates" or so. I wouldn't expect from such a checkbox that it disabled notifications for future updates.
Also, update notifications should be disabled in builds that are neither run_in_place nor installed by the wix installer #6153, by setting the default setting this way

@ghost
Copy link

ghost commented Sep 25, 2018

I think not good, I suggest : Add a news column in main menu is not possible ?

@SmallJoker
Copy link
Member Author

@orwell96

is a bit misleading IMO, it should read "don't notify me on future updates"

That's also a possibility, will adjust the PR accordingly.

update notifications should be disabled in builds that are neither run_in_place nor installed by the wix installer #6153, by setting the default setting this way

Why? Referring the users to the official download page covers all (or at least should) platforms which we support. Official repositories tend to be outdated quickly and people can tick the checkbox once on the initial startup to never get a notification again.

@MrChiantos This is possible but wouldn't provide enough new and helpful information since the (half/)yearly updates would be likely the only content.

@orwell96
Copy link
Contributor

orwell96 commented Sep 26, 2018

update notifications should be disabled in builds that are neither run_in_place nor installed by the wix installer #6153, by setting the default setting this way

Why? Referring the users to the official download page covers all (or at least should) platforms which we support. Official repositories tend to be outdated quickly and people can tick the checkbox once on the initial startup to never get a notification again.

You're right, that suggestion was bullsh*t...

@t4im
Copy link
Contributor

t4im commented Oct 5, 2018

How about setting the defaults via cmake flag, with it defaulting to no updates?

  • During release builds you can flip this on, so that the distributed prebuild releases come with the check enabled
  • Distributions building their own releases can enable or disable updatechecks according to their policies
  • Anyone building a dev build from source would automatically skip it (if you build from git, you are already in full control of the version you are building anyway, especially if you intentionally build an older version for testing)

This would then work as wanted without depending on having the right minetest.conf ready or additional version information passed around.

@SmallJoker SmallJoker force-pushed the update_info branch 2 times, most recently from e2a1326 to 3f4effe Compare October 28, 2018 07:49
@SmallJoker
Copy link
Member Author

@t4im Thanks for your suggestion. I added the CMake config UPDATE_CHECKER_DEFAULT which allows distributions to disable the checker by default. Defaulting to false for in-development builds seems however wrong, because there are people who use the Windows development builds from the forums or Linux users which take the binaries from the daily PPA.

@t4im
Copy link
Contributor

t4im commented Oct 28, 2018

Well, anyone doing the windows development builds and daily ppa builds could flip this on as well.

The idea behind the default was that someone cloning the git repository to compile it themselves would have a default of no-updates without having to opt-out.
But anyone downloading a prebuild binary from someone else could have it enabled by the person doing the build (or more likely the CI system configuration) flipping the updates on.

This ensures that no one has to switch it on and off all the time (assuming CI systems being used for daily development builds)

@Fixer-007
Copy link
Contributor

BTW, what is the difference between "OK" and "Remind me later"?

@Desour
Copy link
Member

Desour commented Oct 30, 2018

I think, "Ok" means something like "OK, I understood, don't tell me about this version again.".

@nerzhul
Copy link
Member

nerzhul commented Nov 5, 2018

i think it can be good to embed the update API in server list or another such program which will cache the github API calls for 1h or more, and control the backend API in case of at a point a migration outside github will be done (i don't say in the next year, but maybe at a point github will have too many problems).

@rubenwardy rubenwardy removed the Action / change needed Code still needs changes (PR) / more information requested (Issues) label Apr 7, 2022
@rubenwardy rubenwardy added the Concept approved Approved by a core dev: PRs welcomed! label Apr 25, 2022
@sfan5 sfan5 added this to the 5.6.0 milestone May 8, 2022
@rubenwardy
Copy link
Member

This is done from my point of view, it's just that Android error that needs to be fixed

@SmallJoker
Copy link
Member Author

Maybe rebasing fixes the Android issue? 🤔

I also squashed closely related commits to keep the overview.

@Zughy Zughy added the Action / change needed Code still needs changes (PR) / more information requested (Issues) label Jun 12, 2022
@sfan5 sfan5 added Rebase needed The PR needs to be rebased by its author. and removed Help needed labels Jul 14, 2022
@sfan5
Copy link
Member

sfan5 commented Jul 14, 2022

If this is broken on Android and we want it for 5.6 maybe it could just be disabled on there? Most users get MT via an app store anyway (which takes care of updates).

builtin/mainmenu/dlg_version_info.lua Show resolved Hide resolved
android/native/jni/Android.mk Show resolved Hide resolved
src/defaultsettings.cpp Outdated Show resolved Hide resolved
@sfan5
Copy link
Member

sfan5 commented Jul 14, 2022

Actually the variable is merely missing here:

arguments '-j' + Runtime.getRuntime().availableProcessors(),
"versionMajor=${versionMajor}",
"versionMinor=${versionMinor}",
"versionPatch=${versionPatch}",
"versionExtra=${versionExtra}"

@sfan5 sfan5 removed the Rebase needed The PR needs to be rebased by its author. label Jul 14, 2022
This feature is enabled by default for release builds. Package
maintainers may use -DENABLE_UPDATE_CHECKER=0 to disable this.

Co-authored-by: rubenwardy <[email protected]>
@SmallJoker
Copy link
Member Author

Nice catch, thank you @sfan5.
Checks on Android are now disabled, as requested.

@SmallJoker SmallJoker removed the Action / change needed Code still needs changes (PR) / more information requested (Issues) label Jul 16, 2022
Copy link
Contributor

@Niklp09 Niklp09 left a comment

Choose a reason for hiding this comment

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

works:)

@sfan5
Copy link
Member

sfan5 commented Jul 19, 2022

I pushed a commit that fixes some potential issues (and moves a few lines around for no reason) and tested the feature. In principle this has my +1.

Just two things:

  • can we make the dialog a bit bigger? It doesn't need to be so tiny
  • what happens if the http request takes a long time and the player is already in e.g. the world creation menu?
    • the dialog should probably simply be not shown (it can be shown when the next check happens)

sfan5 pushed a commit that referenced this pull request Jul 20, 2022
strings from #12131 and #7629 included prematurely for sake of the release
@sfan5
Copy link
Member

sfan5 commented Jul 23, 2022

The following should work to detect if we're still in the main menu (and not some dialog):
if not ui.childlist["maintab"].hidden then

Testing code:

--- a/builtin/mainmenu/tab_about.lua
+++ b/builtin/mainmenu/tab_about.lua
@@ -141,7 +141,10 @@ return {
        end,
        cbf_button_handler = function(this, fields, name, tabdata)
                if fields.homepage then
-                       core.open_url("https://www.minetest.net")
+                       core.handle_async(function(_) os.execute("sleep 5") end, "",
+                       function()
+                               print(dump(_G.ui))
+                       end)
                end
 
                if fields.share_debug then

click the homepage button, switch to some other part of the menu and see what the internal state looks like

Copy link
Member

@sfan5 sfan5 left a comment

Choose a reason for hiding this comment

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

Works.

@SmallJoker SmallJoker merged commit a81259d into minetest:master Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Concept approved Approved by a core dev: PRs welcomed! Feature ✨ PRs that add or enhance a feature @ Mainmenu One approval ✅ ◻️
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet