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

Lwjgl3Net: Fallback to xdg-open on Linux if Desktop.BROWSE is unavailable #6719

Merged
merged 1 commit into from
Dec 12, 2021
Merged

Conversation

kyu-n
Copy link
Contributor

@kyu-n kyu-n commented Dec 8, 2021

When using a libGDX application inside of a linux sandbox container (Snap/Flatpak), Net#openURI will fail to open any url because the Desktop.BROWSE action is unavailable. This is intended behavior of the sandbox. You're supposed to use xdg-portals to access urls in these environments.

The simplest way to workaround this limitation is to call xdg-open for the target uri. There's no guarantee it'll be able to handle your uri if a mime type is undefined for the sandbox, but it'll work most of the time. This binary is standard on freedesktop platforms.

…able

* Desktop.Action.BROWSE is unavailable inside of Linux sandboxes. We're expected to use xdg portals where available
try {
Desktop.getDesktop().browse(new URI(uri));
return true;
} catch (Throwable t) {
return false;
}
} else if (SharedLibraryLoader.isLinux) {
try {
(new ProcessBuilder("xdg-open", (new URI(uri).toString()))).start();
Copy link
Member

Choose a reason for hiding this comment

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

Maybe new URI(uri).toString() can just be url?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This appears messy, but it has a purpose. Running the uri through a URI builder sanitizes the input to prevent arbitrary code execution on a client system by other players in online environments.

See #6543 (comment) for details

Copy link
Member

Choose a reason for hiding this comment

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

That makes sense. Good to keep it!

@PokeMMO PokeMMO merged commit 42a59f2 into libgdx:master Dec 12, 2021
Quillraven pushed a commit to Quillraven/libgdx that referenced this pull request Jan 2, 2022
…able (libgdx#6719)

* Desktop.Action.BROWSE is unavailable inside of Linux sandboxes. We're expected to use xdg portals where available
crykn added a commit that referenced this pull request Jan 4, 2022
Add changelog entries for the notable changes in #6386, #6595, #6600, #6609, #6611,  #6621, #6637, #6701, #6719, #6721, #6722.
@kyu-n kyu-n mentioned this pull request Jan 17, 2022
SimonIT added a commit that referenced this pull request Feb 8, 2023
* (#6480) load parallax factor value from Tiled

* (#6480) add parallax layers

* (#6480) add parallax render support (first draft)

* (#6480) set parallax scrolling factor

* (#6480) update parallax rendering

* (#6480) use cache boundaries for cached renderer

* (#6480) remove unused method

* (#6480) update CHANGES

* (#6480) remove unused Vector3

* (#6480) fix formatting

* (#6480) fix hierarchical scrolling factor loading

* (#6480) update parallax rendering (tile and image layer)

* (#6480) remove wrong comment

* Replace gradle deprecations (#6652)

* Upgrade gradle wrapper to 6.9

* Update junit

* Replace deprecated compile for dependencies

* Replace deprecated archiveName with archiveFileName

* Upgrade to gradle 6.9.1

* Replace compile to api in headless

* Update gdx-jnigen to 2.2.1 to fix build issues. (#6720)

* Add back breaking change notice (#6723)[CI skip]

* Update to LWJGL 3.3.0

* Revert "Temporarily comment LWJGL3 macOS ARM64 dependencies"

This reverts commit 7ac239c.

* Update fetch.xml

* fix bad camera reference by using instance variable instead of parameter (#6722)

* Javadocs to make it clear Pool doesn't reset if discarding.

* Revert "Fixed texture packer legacy output having wrong Y value when using padding."

This reverts commit 08cd7fd. Turns out the "fix" was actually a bug!

closes #6701

* fix #6618 move vertex array index buffer limit to backends (#6621)

* fix #6618 move vertex array index buffer limit to backends

* Apply formatter

* fix test

* Apply formatter

Co-authored-by: GitHub Action <action@github.com>

* Add missing .gitignore to gdx-bullet

* Lwjgl3Net: Fallback to xdg-open on Linux if Desktop.BROWSE is unavailable (#6719)

* Desktop.Action.BROWSE is unavailable inside of Linux sandboxes. We're expected to use xdg portals where available

* add back default Pool behavior when object is discarded (#6730)

* Remove all usage of Arial assets, replace with LSans. (#6727)

* Fixes Gradle build issues (GWT Tests, Runnable Tools) (#6731)

* Let buildRunnables task depend on build task so all dependencies are present

* gwtref: Throw ClassNotFoundException instead of RuntimeException in ReflectionCache.forName (#6718)

* gwtref: Throw ClassNotFoundException instead of RuntimeException in ReflectionCache.forName

Fixes #6708

* gwt/emu/reflect: Add exception cause in ClassReflection.forName

* Gradle publishing support (#6725)

* Should match maven for artifacts, including `$NAME-platform` artifacts for jnigen natives.

* Clean Up PixmapBlendingTest (#6732)

This may fix an unclear issue with PixmapBlendingTest, as well, but in general it makes the code more readable and idiomatic for a libGDX test.

* Use gradle for github-actions publishing

* javadoc encoding also, remove group from box2d parent

* Update build status badge in README

* Update freetype to v2.10.4 and use submodule.

* Update freetype to v2.11.1

* Populate cppExcludes to prevent build issues in gdx-freetype

* More specific cppExcludes to make android happy

* Add note about breaking change on legacy LWJGL3 projects.

* (#6480) update CHANGES

* (#6480) run spotlessApply on changed map files

* Modified the math in all map renderers to subtract on the x value to the parallax effect works properly.
Modified test maps parallax value so it was easier to see the effect.
Made a change in the BaseTmxMapLoader just to keep it consistent with the rest of the code.

* Changed OrthoCachedTiledMapRenderer to use negative instead of positive like the rest, also changed using cacheBounds to determine parallax to using viewBounds like the rest.
Also modified the ortho map to have a non group parallax layer. so it will show up in OrthoCachetest

* Apply formatter

---------

Co-authored-by: klausm <simon.klausner@swarovski.com>
Co-authored-by: SimonIT <simonit.orig@gmail.com>
Co-authored-by: PokeMMO <2398581+PokeMMO@users.noreply.github.com>
Co-authored-by: MGSX <germain.aubert@gmail.com>
Co-authored-by: Desu <desu@pokemmo.eu>
Co-authored-by: Nathan Sweet <nathan.sweet@gmail.com>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Kyu <kyu@pokemmo.eu>
Co-authored-by: Tommy Ettinger <tommy.ettinger@gmail.com>
Co-authored-by: Justin Shapcott <support@mobidevelop.com>
Co-authored-by: Justin Shapcott <justin@mobidevelop.com>
Co-authored-by: nojus297 <46261165+nojus297@users.noreply.github.com>
Co-authored-by: Yuri Pourre <yuripourre@users.noreply.github.com>
Co-authored-by: Tomski <tomwojciechowski@asidik.com>
Co-authored-by: BoBIsHere86 <rck86@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants