1. Auto Update for WEE?
- Posted by dcuny Jan 28, 2015
- 1924 views
Especially since WEE is in a constant state of change, have you considered adding an auto-update feature? Notepad++ has a feature like this, and it's pretty cool.
Specifically, the user could have an option for the program to check to see if it's the latest version. If not, it could report to the user that there's a new version available. Additionally, it could give the user the option to automatically update the program.
Of course, that assumes a couple of things:
- You've got a stable place to host the code
- It doesn't cost you an arm and a leg to have a bazillion people hitting that site when WEE becomes popular
I'm thinking that an "auto-update" feature could probably be written as a fairly generic routine, so other programs could use it as well.
Just a thought.
- David
2. Re: Auto Update for WEE?
- Posted by PeteE Jan 28, 2015
- 1885 views
I think this can be done, after I put the code on github. I think I can use std/net/http.e http_get() to download a file manifest containing the version number, file names and checksums. If the version number changes, then download files that have a different checksum.
I'm torn on whether to check for updates during startup. On startup, if the user has to wait for the http_get() due to a slow DNS resolve or slow connection, that's a little annoying. Maybe I could do the http_get in a separate task, but it's not clear if that will allow the main task to interact with the user. The wee.conf could also store the date of the last check, and only check for updates once per day. I would provide a menu option to check for updates.
3. Re: Auto Update for WEE?
- Posted by euphoric (admin) Jan 28, 2015
- 1869 views
Especially since WEE is in a constant state of change...
Time for a multitude of developers and a code repo!
haha...
4. Re: Auto Update for WEE?
- Posted by SDPringle Jan 28, 2015
- 1887 views
Unix is only normally secure because only admin installs programs. If you do your day to day activities as a Limited User account on Windows, your exposure to threats is incredibly reduced. Now, if programs are updating themselves this means the user has write access to the editor. This is a bad thing. Check if you want to check, but please download to the download folder. I become root for the install process but normally I run my computer as a limited rights user. Viruses can infect good programs and misuse them.
5. Re: Auto Update for WEE?
- Posted by ghaberek (admin) Jan 29, 2015
- 1908 views
I think this can be done, after I put the code on github. I think I can use std/net/http.e http_get() to download a file manifest containing the version number, file names and checksums. If the version number changes, then download files that have a different checksum.
I'm torn on whether to check for updates during startup. On startup, if the user has to wait for the http_get() due to a slow DNS resolve or slow connection, that's a little annoying. Maybe I could do the http_get in a separate task, but it's not clear if that will allow the main task to interact with the user. The wee.conf could also store the date of the last check, and only check for updates once per day. I would provide a menu option to check for updates.
DNS (i.e. host_by_name) is not tasking-enabled, so it will block other tasks.
But the rest of the process can be integrated into WEE using multi-tasking.
Here are the bits of code I added to WEE (in ui_win.e) to check for mock updates.
I needed a function to show a simple "OK" message box.
global function ui_message_box_ok(sequence title, sequence message) atom result result = c_func(MessageBox, {hMainWnd, alloc_string(message), alloc_string(title), or_all({MB_APPLMODAL, MB_ICONINFORMATION, MB_OK})}) free_strings() return result = IDYES end function
Here is the routine that "checks" for an update.
constant WEE_UPDATE_URL = "http://openeuphoria.org/index.wc" procedure check_version() atom task_id = task_self() -- sleep for a few seconds before checking -- so we don't immediately bombard the user task_delay( 3 ) task_yield() -- fetch the latest version information object result = http_get( WEE_UPDATE_URL ) if atom( result ) then -- failed to check for updates ui_message_box_error( "WEE Update", "An error occurred while checking for updates." ) else -- success, perform additional update steps ui_message_box_ok( "WEE Update", "A new version is available." ) end if -- stop this task task_suspend( task_id ) task_yield() end procedure
Here we create and schedule the task before showing the window and starting the event loop.
atom check_id = task_create( routine_id("check_version"), {} ) task_schedule( check_id, 1 ) c_proc(ShowWindow, {hMainWnd, SW_SHOWNORMAL}) c_proc(UpdateWindow, {hMainWnd})
And finally, we add a call to task_yield in the event loop.
while c_func(GetMessage, {msg, NULL, 0, 0}) do if hFindDlg and c_func(IsDialogMessage,{hFindDlg,msg}) then -- this message is handled by find dialog (thanks Jacques) -- it makes the tab key work for find/replace dialogs else translate_editor_keys(msg) junk = c_func(TranslateMessage, {msg}) junk = c_func(DispatchMessage, {msg}) end if task_yield() end while
Unix is only normally secure because only admin installs programs. If you do your day to day activities as a Limited User account on Windows, your exposure to threats is incredibly reduced. Now, if programs are updating themselves this means the user has write access to the editor. This is a bad thing. Check if you want to check, but please download to the download folder. I become root for the install process but normally I run my computer as a limited rights user. Viruses can infect good programs and misuse them.
Nah.
- Package the update into its own installer.
- Download the installer to a temporary location (e.g "Downloads").
- Launch the installer with admin permissions from the editor. ("runas" on Windows or "gksudo" on Linux)
- If the installer launched successfully (user allowed admin action), then quit the editor.
-Greg
6. Re: Auto Update for WEE?
- Posted by PeteE Jan 29, 2015
- 1884 views
Thanks Greg, that's useful to know for future reference. However I don't feel that WEE is ready for a full installer executable yet.
For now, I'm putting the source on GitHub repo here and if you "git clone" it you can get updates using "git pull". There is a Windows GitHub client, and I think you can use it without an account if you don't already have one. Once installed, there is a button on the repo page "Clone in Desktop" (or you can drag the URL to the window) which should allow you to download the repo and get updates.
I considered making a simple "update.ex" program that downloads the raw links from github using http_get function, but it looks like it doesn't work due to github trying to upgrade the connection to https, which http_get doesn't support.
7. Re: Auto Update for WEE?
- Posted by PeteE Jan 31, 2015
- 1850 views
WEE updater now available. Download it in an empty directory (or an existing wee directory) and run it to download or update the files. It might not be able to update the dll while the editor is running, so please close WEE first. I didn't make it part of the editor for this reason, and I want the user to be able to control when it gets run.
How it works: I created manifest.json file with a sequence of the files in WEE, including the file hash(), github commit tag, optional 32/64 bit flag, and platforms supported by the file. To make the manifest.json file, I run manifest.ex > manifest.json to calculate the hashes and commit tags, and then pushed to the repo.
The updater.ex downloads the manifest.json through rawgit.com since that allows me to download it through http_get() using http instead of https. I have to use a .json extension since rawgit.com has a whitelist of allowed extensions, otherwise it will just redirect to https. Then it uses the file hash to determine if the existing file need to be updated. Outdated files are downloaded from cdn.rawgit.com for speed, and the git commit tag in the URL allows the cdn to cache each version separately.
8. Re: Auto Update for WEE?
- Posted by dcuny Feb 01, 2015
- 1809 views
Got it! Seems to work just fine, thanks!
- David
9. Re: Auto Update for WEE?
- Posted by dcuny Feb 02, 2015
- 1746 views
Something I should have asked for in the auto-update: A changelog!
Specifically, some why of seeing in WEE what the latest changes are. Having an option in the Help menu could load the change log, and it could automatically be loaded when the updater is run.
- David
10. Re: Auto Update for WEE?
- Posted by PeteE Feb 02, 2015
- 1732 views
Something I should have asked for in the auto-update: A changelog!
Specifically, some why of seeing in WEE what the latest changes are. Having an option in the Help menu could load the change log, and it could automatically be loaded when the updater is run.
- David
Well, I've been just putting changelog comments in wee.exw for each change, but haven't been keeping track of the version number. After all, WEE is an editor for developers, haven't you looked at the source code? Since the ui is split into Windows and GTK files, I've started putting changelog comments into those files as well. And now that I'm using git version control, I've got to write a changelog for each commit too. But my git discipline is lacking, and I frequently forget to do only one feature per commit, and end up with a mish mash of things in commit logs and patches. I'll consider a menu item for showing a changelog, but no promises.
11. Re: Auto Update for WEE?
- Posted by dcuny Feb 02, 2015
- 1713 views
It's not a biggie. The main thing it that it stops me from asking for things that are "broken" in WEE when they simply haven't been implemented yet.
Plus, it reminds me to try out new features I didn't know about.
- David
12. Re: Auto Update for WEE?
- Posted by K_D_R Feb 04, 2015
- 1662 views
WOW! REALLY NEAT! Thanks, Pete!
13. Re: Auto Update for WEE?
- Posted by K_D_R Feb 04, 2015
- 1659 views
Since the ui is split into Windows and GTK files, I've started putting changelog comments into those files as well.
I haven't seen the GTK include file -"ui_gtk.e" right?
Regards, Ken
14. Re: Auto Update for WEE?
- Posted by PeteE Feb 04, 2015
- 1645 views
I haven't seen the GTK include file -"ui_gtk.e" right?
Hi Ken,
The GTK version is almost in a usable state. Some dialogs are missing: Find/Replace, View Subs, View Error; Run doesn't work, external file modifications aren't realized.
But if you want to test it, just run updater.ex with Linux eui and it should grab the platform dependent files. If you're running a 64-bit Linux, you'll probably have 64-bit GTK libraries only, so to be compatible you'll need 64-bit Euphoria and a recently compiled one at that. If you haven't compiled Euphoria yourself, it sounds like a new 4.1.0 beta is coming soon.
15. Re: Auto Update for WEE?
- Posted by K_D_R Feb 04, 2015
- 1661 views
I haven't seen the GTK include file -"ui_gtk.e" right?
Hi Ken,
The GTK version is almost in a usable state. Some dialogs are missing: Find/Replace, View Subs, View Error; Run doesn't work, external file modifications aren't realized.
But if you want to test it, just run updater.ex with Linux eui and it should grab the platform dependent files. If you're running a 64-bit Linux, you'll probably have 64-bit GTK libraries only, so to be compatible you'll need 64-bit Euphoria and a recently compiled one at that. If you haven't compiled Euphoria yourself, it sounds like a new 4.1.0 beta is coming soon.
OK, your right this is the error message I get after running updater.ex with eui:
home/kenneth/euphoria/include/std/error.e:52 in procedure crash() You need a newer 64-bit Euphoria with callback bug fix ... called from /home/kenneth/Programs/old_progs/euprogs/wee/wee-0.16/wee-0.16/ui_gtk.e:28 in function check_callback_func() ^^^ call-back from external source ... called from /home/kenneth/Programs/old_progs/euprogs/wee/wee-0.16/wee-0.16/ui_gtk.e:34 --> See ex.err
So, I hope 4.1.0 beta comes out soon!
I'm very, very impressed with your updater.ex, Pete!
Regards, Ken