cztomczak/phpdesktop

Funding for a Linux release [$1,500 of $1,500]

cztomczak opened this issue Β· 90 comments

For those interested in sponsoring a Linux release. This initial Linux release would include basic functionality - only some of the options in the settings.json file would be supported. With time more settings may be added. For now let's just make it work on Linux!

Funding will be carried out using bountysource.com website. Multiple people can post bounties and make up for the goal ($1,500). See the issue on bountysource:

https://www.bountysource.com/issues/53303038-funding-for-a-linux-release

Related issue: #77 ("Linux support").

Fundings for other features presented on the PHP Desktop Pro wiki page are also possible.

So there is no BETA to test ?

Pull requests are welcome.

Great, In regards to testing with different OS's, thats something I can definitely do. I do DevOps bits, so I've started looking at creating a pipeline that can run tests automatically after a commit/tag, getting them to run on multiple OS's should be reasonably simple. I'll hopefully have something useful in about a week. I'll also create a VM dev environment for it too.

Also as an FYI, I'll be meeting either half or all of this next week. Thanks

Okay, great.

I am waiting for linux support release,

Hey @cztomczak , I've just posted half the bounty for this job - Unfortunately a bit late... I'll get the rest in over the next couple of weeks. Thanks in advance :)

@phpengine Thank you :-) I will take on step one, which is to investigate the best option for the GUI framework to use. As described in Issue #77, either CEF Views can be used (these unfortunately are not supported on Mac, so cannot be reused) or GTK API can be used. CEF Views have some nice features and easy integrate with CEF without any focus/keyboard issues. When using GTK the code is more complex, but has no limitations on CEF limited API, however there are known keyboard issues as reported here.

I've been testing CEF views and everything works fine. You can run upstream cefclient sample application in views mode by passing --use-views flag. Views API is very straightforward and its api is available in CEF's include/views/ directory. Classes that interest us are CefWindow and CefBrowserView. CefWindow has some useful methods that will make easy to expose these features via settings.json: CenterWindow, SetAlwaysOnTop, SetFullscreen, SetWindowIcon, SetWindowAppIcon. I've run performance tests in both normal mode in cefclient and with views and both modes have the same performance. (ran tests > webgl).

CEF on Linux unlike CEF on Windows doesn't have all the features built-in. For example there is no default implementation for dialogs on Linux. These need to be implemented by app. When running cefclient > tests > dialogs you can see that they don't work. This includes things like:

  • js dialogs such as alert/confirm/prompt
  • file dialogs (open, save)
  • print dialog (from mouse context menu or when called via window.print)

Each of these (js dialogs / file dialogs / print dialog) need to be implemented separately, so these are three tasks in total. @phpengine Which of those are essential for you?

Drag and drop within window works out of the box. However drag and drop from external sources doesn't work. I don't think dragging files from external sources works neither on Windows.

I've asked question on the CEF Forum in regards to implementing dialogs when using CEF Views. CEF topic for reference: https://magpcss.org/ceforum/viewtopic.php?f=6&t=15778

Hey, sorry it took so long to repond. I've spent most of the last week bedbound by flu. Thanks for these, I've had a look, and I think we'd need them all. Having said that though, I've already written replacements for the JS Dialogs, so we could do those last. I'd also be happy to put as much more in the bounty as we need, if it could be possible get them all in at some point. I would say file dialogs would be most important for me, as one of the first apps we'll try to build is like Office. Thanks, Dave

Sorry to hear that you're sick. I wish you a fast recovery. Okay so file dialogs are priority no1. Hopefully these can be easily integrated with CEF Views using existing implementation in cefclient, will see.

Hi, any updates in this. I am waiting for linux desktop release. I will also try to fund. Thank you

The goal for this funding is set to $1000. So far only $500 was posted.

Hi guys, sorry it's been a while. I've just posted an extra $350 in. Hope it helps! Thanks @cztomczak

Not sure whats wrong with the payment... I sent it and paypal sent me a receipt but its not showing on the bountysource site. I've emailed them. I'll hopefully do the rest next week :)

Thanks. The earliest I can start working on this feature is somewhere after June.

@cztomczak I am so happy to see a Linux build is planned. Are you working on this already and is an ETA planned? (I'm not sure if we're talking 3 months, 6 months etc?). I use PHP Desktop daily from my Windows machine and it rocks!! I'd be happy to chuck in $100 into your pot if you can make a Linux build happen (and also let us know an ETA) :-)

I only did initial investigation of what solutions to choose so far. The goal is still not met, so the actual coding has not yet started. I've just increased the goal to $1,500. The work will begin after the goal is met.

@phpengine If you would like to withdraw your bounty, since I've increased the goal, you are free to do so.

Oh right, reading through comments it seems like you're actually on $850 and the new goal is $1500?
I can put $100 in, maybe a little more and $200 at max, but don't think it'll quite get us there?

PS - this'll be totally worth it for the money, just need to find that money for you :-)

There is the "Backers" tab on bountysource and I can only see $500 posted there.

@phpengine In case you haven't heard, bountysource will be taking fees for unclaimed money over 90 days. I am considering changing the funding platform, as this doesn't sound right. One alternative is https://issuehunt.io/ .

Original announcement about the fees from bountysource:

Bountysource is a community orientated platform with minimal operational overheads. Holding money for extended periods of time is causing costs to be incurred in accounting and maintaining the balance sheet. Bountysource management will be adding an inactivity fee to minimise costs in holding your money for long periods.

From 1st December 2018 we intend to start applying a monthly fee of $10 + 10% for unclaimed money over 90 days

You can avoid the inactivity fee by simply withdrawing your money regularly.

Note: All crypto bounties you earn are not affected as Bountysource incurs no cost in holding crypto bounties for you. Additionally there is currently no fees charged for crypto bounties. We encourage you to post crypto bounties instead.”

Thanks,
The Bountysource Team

@phpengine If the bounty doesn't reach $1,500 this month, I suggesst you withdraw the money from bountysource to avoid the fees. You should do it before December 1st.

@cztomczak Hey dude, thanks for the heads up there, I thought it might be more efficient if I just get it done in the next week. I probably should have checked the exact status of this change to the terms of the payment first... but I'm sure I can get the remaining $150 in within a week. What happens after that on Bountysource? If needed, I can withdraw those payments and put them into the Issuehunt task you mentioned, or we can finish this one in Bountysource and do the others on Issuehunt. Do you have a preference there?

@phpengine Thanks. It looks like that if you withdraw the money from bountysource you have to pay 10% fee. Regarding the 10% fee for unclaimed money, it's not clear if this also applies to active issues that people are working on. I took a look at issuehunt.com and their fees are also not clear. You can email bountysource support and ask about the 10% unclaimed fee, if it applies here.

@mattpass There is only $150 missing here to make for the goal.

@cztomczak @mattpass , not anymore, Let's go :)

@phpengine you put in the money? Awesome! I'm happy to put my $150 in tho, so if you already paid it, I can send to you. So so eager for this to happen and have my code editor on native Linux (currently only on Windows).

More than happy to send you the $150 @phpengine as you've been awesome and stumped up most of the bounty I think. Least I can do is chip in a little? (Paypal?)

Great. The Linux release should be ready in about a month.

@phpengine You've already mentioned that dialogs are vital for you. What options from the settings.json file are most essential to you?

@mattpass I'd say maybe chuck it into the OSx Version? Looks like a good shout for the IDE, all major platforms and such like. Might help to reach that goal a bit quicker? Also, on that note, and the idea that unclaimed funds are likely to be largely taken by Bountysource, maybe we should wait for the Issuehunt version or something similar?

@cztomczak , I'll have a look over the weekend and get back to you on those bits? Great, I'm massively looking forward to it

I've written to Bountysource support to explain what exactly do they mean by unclaimed money. Whether this applies only to closed issues or open issues as well. It's not clear if this is the case here.

@phpengine while I'm not a Mac user (or fan), I agree it'd be great to have PHPDesktop across all major platforms (Linux/Win/Mac) so have put my $150 into that as suggested.

@cztomczak keep up the good work dude, you rock and I can't wait to use the Linux version one day soon! πŸ‘

@mattpass Thanks. I've updated issues and the fundings section on project's main page, so that people can easily see the status of fundings, see: https://github.com/cztomczak/phpdesktop#fundings-for-new-features

Created Build on Linux wiki page (work in progress) and will be updating with time.
Created "linux70" branch (empty currently).
Will be using CEF 3538 branch for Linux - includes Chrome v70.

Build on Linux wiki page was updated with complete build instructions. Commit ed145a6 adds basic stuff working. App builds and runs. Just loads Google web page.

Good news! PHP Desktop for Linux is basically working. Successfully embedded Mongoose server and PHP CGI. PHP Desktop app currently displays a window with CEF browser embedded, and navigates to mongoose server which serves index.php which displays phpinfo(). See screenshot below. Updated "Build on Linux" wiki page with instructions on how to build PHP from sources. New commits added in linux70 branch. The settings.json file and options are yet to be implemented along with a few other things.

phpdesktop-linux-working

PHP Desktop for Linux v70.0 released for early testing. Download binaries from:
https://github.com/cztomczak/phpdesktop/releases/tag/linux-v70.0

Things yet to be done for the basic functionality:

  • Add test scripts in the www/ directory (test sqlite for sure)
  • Configurable through settings.json file
    • server ip address / port
    • www directory
    • log file and log severity
    • cache_path directory
    • command line switches
    • remote debugging port
    • temp dir
    • 404_handler for pretty urls
    • cgi interpreter, cgi pattern, hide_files_pattern
  • Window title configurable via settings.json
  • Window default size configurable via settings.json
  • App icon configurable via settings.json
  • Enabling downloads configurable via settings.json
  • Developer tools from mouse context menu configurable via settings.json
  • Maybe JS dialogs and print dialog (low priority as @phpengine stated)
  • Maybe single instance application and maybe guid option in settings.json. @phpengine Do you need that?
  • Maybe more mouse context menu options like Reload, Open in external browser, configurable via settings.json
  • Maybe start fullscreen option in settings.json
  • Maybe support for configuration of Popup windows via settings.json (fixed title, size, icon)
  • Maybe expose javascript API "window.phpdesktop" object with methods: GetVersion, ToggleFullscreen, IsFullscreen

Bugs to be fixed:

  • php-cgi process never ends and hangs after PHP script was served. Although these processes end when application quits. See screenshot:
    image

Fixed php-cgi processes hanging in commit 3a56b93.

Updated the linux-v70.0 release page with new v70.1 binaries. I will be updating that release continuously until we have a stable release and then I will make a new final release.

I've posted about the release on reddit's /r/PHP and there is a considerable interest:
https://www.reddit.com/r/PHP/comments/a27c2w/php_desktop_for_linux_v700_released_early_testing/

I've just tested on Fedora 25 - works out of the box. Should also work on Debian and OpenSUSE.

Hey @cztomczak , works really well so far, thanks! Now that I have dropped a couple of apps into a www folder locally, I've got a much better idea of bits we might want: like the mentioned default size, developer tools, and ideally a way to wrap it all into a single .run file or something so a user can download a file they can run without extracting. Where would I put those ideas? Thanks again

@phpengine That's good. The size, devtools - that will be done. The old standard on Linux to wrap applications is to create a package (an installer): .deb on Debian/Ubuntu, .rpm on Fedora/CentOS/RedHat/OpenSuse. It can be hard, but that's how it is done for most of the packages that are installed on your Linux. As for other modern ways of distributing app you can try:

  1. AppImage - single file approach, looks easy and cool, see: https://appimage.org/ . I've tried their demo app and there is option to either run app or optionally install along with creating taskbar icons for the app.
  2. Flatpak - see https://flatpak.org/
  3. Snap packages: https://snapcraft.io/

I think packaging app is out of scope for the project. I mean we can provide docs/FAQ on how to do things, but I don't think phpdesktop binaries need to be distirbuted this way. I think an archived file as it is currently is just fine.

Ah great, actually, making something that will integrate one of the above solutions, in a repeatable, publishable manner will be well within scope for me, as I make DevOps tools. Thanks for the advice in approach and I agree that it is out of scope for packaging to be part of the PHP Desktop project itself. As an FYI, I like the AppImage approach as it looks like could offer a single executable across Linux distributions. If for any reason it's not as expected, RPM's and DEB's will be the next option. I'll probably also publish the scripts for building these so others can use them too. Thanks again

Hi @cztomczak, also, will Selenium/Behat tests work using chromedriver and the remote debugging port?

And if possible, could the Developer Tools functionality be nearer the top of the list, or is there a way I can turn those on for myself during development with a flag somewhere? Thanks

@phpengine Yes, Selenium is supported, see (example Java code):
https://bitbucket.org/chromiumembedded/cef/wiki/UsingChromeDriver

To enable DevTools run with the command ./phpdesktop --remote-debugging-port=1234 and then open http://127.0.0.1:1234/ url in external Google Chrome browser.

@phpengine You can also interact with DevTools using this PHP library:
https://github.com/jakubkulhan/chrome-devtools-protocol

Thanks for that @cztomczak , I've got DevTools running smoothly, please integrate it in your own time. I have another question though, I'd like to be able to close the application using a button in the application. What's the best way to do that please? Should I run some OS/System command, or is there a PHP / JS method I can call to do it natively? Thanks

@phpengine Call js window.close method.

@mattpass I will update to v71 which is already available on Spotify builds.

Sorry for the delay guys, I was sick and all my work was delayed.

@cztomczak no worries, hope you're feeling better now? I'll be happy to test it when more evolved and you feel it's in a good position for testing.

Yes, I'm much better, but now I need to catch up with this and all the other delayed work. The hardest part on phpdesktop for Linux was done, I just need to finish it.

Ah indeed, rest is important. Good to hear you're feeling better too

New release 70.2 is available for download:
https://github.com/cztomczak/phpdesktop/releases/tag/linux-v70.0

Commit e290e06 adds:

  • Support for configuration via settings.json file. A few options supported at the moment: app icon, window title, window size, center on screen.
  • Embedding via GTK API
  • Handles termination signals SIGINT, SIGTERM (ctrl+c via keyboard)
  • Mysqli and Postgresql extension support in default PHP binaries

Great news, I'll update today, thanks

Commit 9c55709 adds support for single instance application (application.single_instance_guid in settings.json). If another instance is already running it will show such dialog message:

phpdesktop-single-instance

Also, it was implemented in previous commit, but worth mentioning. When application fails to read settings.json file (does not exist or empty) it will display such message:

phpdesktop-settings-json-error

Commits d66ef75 and 170d7c3:

  • Fix $_ENV["SERVER_ADDR"] not being set
  • Fix keyboard issues. Keyboard didn't work at all after migrating to GTK based embedding.
  • Add scripts in the www/ directory. Still not working: dialogs.php (alert, print, file dialog) , downloads.php, cookies.php (not persisted on app relaunch), temp_dir.php (web_server.cgi_temp_dir option still missing), upload.php (not tested, because file dialog not yet implemented).
  • Initial support for Popup browsers (popup.php). Icon for popup is not set and title is fixed (same as main window). When main window is closed app exists even when there are still popups open.
  • Support for Quota Requests / HTML 5 persistent storage (see request-quota.php) (#107)

Commits fd1c236 and aea2597 add support for Javascript dialogs (alert, confirm, prompt), Print dialog and Input type=file dialogs.

Commits 648ac50, f30b4a0 and 16448d1 added lots of new options. Currently all options from the settings.json file below are supported:

{
    "application": {
        "single_instance_guid": "",
    },
    "main_window": {
        "title": "PHP Desktop",
        "icon": "app-icon.png",
        "default_size": [800, 600],
        "center_on_screen": true,
    },
    "web_server": {
        "listen_on": ["127.0.0.1", 0],
        "www_directory": "www",
        "index_files": ["index.html", "index.php"],
        "cgi_interpreter": "php-cgi",
        "cgi_extensions": ["php"],
        "404_handler": "/pretty-urls.php",
        "hide_files": []
    },
    "chrome": {
        "log_file": "debug.log",
        "log_severity": "default",
        "cache_path": "webcache",
        "external_drag": true,
        "remote_debugging_port": 0,
        "command_line_switches": {
            "enable-media-stream": "",
            "enable-system-flash": ""
        },
        "enable_downloads": true,
        "context_menu": {
            "enable_menu": true,
            "navigation": true,
            "print": true,
            "view_source": true,
            "devtools": true
        }
    }
}

Release 70.3 is available for download, please test:
https://github.com/cztomczak/phpdesktop/releases/tag/linux-v70.0

Release 72.0 is available for download. Updated to latest Chrome/72.0.3626.81. Please test.
https://github.com/cztomczak/phpdesktop/releases/tag/linux-v70.0

I think this release is now feature complete as per the "initial release" discussed in this issue. All important features are working. Please test and if everything works well I will make a final official release in a week or so.

I really don't understand why you using X and Gtk2

Hey @cztomczak , all looks good so far - thanks very much. A couple of questions/points on the settings.json file please.

  1. When I hover over the application icon in the Ubuntu taskbar, it shows Phpdesktop, as opposed to the main window > title value.
  2. What value should I put in GUID? A long random number?

@ZanderBrown Is that a question?

@phpengine

  1. Title in taskbar works fine for me. Can you provide a screenshot and more details on your environment? Ubuntu 14.04 with default window manager in my case.
  2. A random id, see https://www.google.com/search?q=guid . App creates /tmp/{guid}.pid file based on guid, so any chars that can be used as filenames are fine.

@cztomczak

  1. https://gist.github.com/phpengine/99032bc4b485184cc8f0c66ea84e2cd9 Image is shown in the above Gist, I'm using Ubuntu 17.10. I'll try on 18.10 and let you know how that goes.
  2. Cheers, I'll do that today

Hi @cztomczak , for the size of the window, is there a way to specify a percentage of the screen size instead of a fixed pixel value, so it fits on differently sized screens?
"default_size": [800, 600]

@phpengine
It seems that your window manager takes app title in taskbar from executable's name. Just rename "phpdesktop" executable and taskbar title will change accordingly. If you package app and create shortcut for app then you can customize taskbar more.

Regarding percentage of the screen. No, such feature is not available. For now just guess the best size that fits content in your app and make it fixed.

I am open to developing phpdesktop for Linux further. As for this issue the goal was to make phpdesktop for Linux just work. An initial release.

@phpengine If you package app in a way that uses custom scripting then you can customize settings.json during installation of your program.

@cztomczak kinda?

You seem to have made a backwards step without really explaining why

My (very brief) look at the commit didn't reveal anything hence my statement

Disclaimer: I am a member of the GNOME Foundation and know those responsible for Gtk

@ZanderBrown Are you having any specific issues with GTK 2 in phpdesktop? Or is it GTK in general? Upstream CEF depends on X11, so you can't get rid of that. Upstream CEF sample application cefclient which is best tested for most features is written using GTK 2. I've copied code that handles dialogs (js, print, file) from cefclient, so it is based on GTK 2 and reusing that code saved me much time.

Upstream CEF currently depends on X11, although there are plans to support other alternatives in the future.

I have no issue with Gtk, quite the opposite

There isn't that much variation between Gtk2 & 3 for what you seem to be doing but using 2 means your starting a new product based on deprecated technology with no support for HiDPI or Wayland (amongst other things)

Whilst it's true upstream CEF does force you to have an indirect dep on X there is no reason for you to use it downstream rather than use Gtk API allowing you to get "Wayland for free" once CEF supports it

In regards to further development, I'll probably put together a list of bits of bits I'd like or need to use, and then maybe use that as a baseline for all three OS versions. I'll spend a few days on that, and probably just list those things here.

In regards to what @ZanderBrown mentioned, I don't know how enough about the internals of what's being built to be able to comment as yet, so if its necessary or beneficial enough then it could go on to that list or be looked at for future?

@ZanderBrown The only thing that forces GTK 2 in phpdesktop is the dialogs (js, print, file). I was very clear in this issue that the goal was to make phpdesktop just work on Linux with its initial release, not to make it perfect. The resources (money) are limited. Pull requests to upgrade this code to GTK 3 are welcome.

@phpengine Sure, make a list and we can discuss it.

@ZanderBrown Personally I don't like the tone of your comments. I don't see you contributing to this funding or the project, so I don't understand the basis for your pretentions.

Pull requests to upgrade this code to GTK 3 are welcome.

I can give it a go I guess, currently failing to build using your instructions though

ninja cefclient fails with a load of error: β€˜cfi-icall’ attribute directive ignored [-Werror=attributes] (cef_binary_3.3538.1852.gcb937fc_linux64 / g++ (GCC) 8.2.1 20181215 (Red Hat 8.2.1-6))

I don't see you contributing to this funding or the project

Sure but I've used it in the past

I don't understand the basis for your pretentions

As previously state I am associated with the upstream for some of the technology involved + want to see phpdesktop do well, I have no intention of seeming pretentious here

@ZanderBrown Please report build problems on the Forum. Here are my versions of tools:

cmake version 2.8.12.2
g++ (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
ninja 1.7.2

I did a new release PHP Desktop v72.1 for Linux a few days ago. I've posted a news about it on reddit, so quite a few people already tested it and everything is working fine.

It's time to close this issue.

@phpengine When you have a list of new tasks ready, please send me an email and we can discuss it there.

@phpengine I have submitted a claim for the bounty on bountysource. It says that two users need to approve this. It seems you have backed it using two different accounts.

@cztomczak , apologies for the delay there, I'm about to release the bounty. All the bits I've checked worked fine so far. I've fully ported over the first electron app. If anything minor or missed comes up, can I add it here for you? As mentioned before, I'm still working on that list of new bits. Thanks, look forward to working with you again or the OSx and Windows versions!

@cztomczak Payment released

@phpengine Thank you. It's all fine. For new tasks I guess we can talk via email and then create new issues in the tracker for these tasks.