Chromium WebGadget v4

Developed or developing a new product in PureBasic? Tell the world about it.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium WebGadget v3

Post by JHPJHP »

Updated:
- various improvements to the framework
- improved fullscreen script: CrWG_Player.pb
- added fullscreen script: CrWG_TabBar.pb

Image
Last edited by JHPJHP on Fri Jun 02, 2023 2:35 pm, edited 7 times in total.
User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 627
Joined: Fri Dec 04, 2015 9:26 pm

Re: Chromium WebGadget v3

Post by skinkairewalker »

Can we currently compile Chromium WebGadget on x86?
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium WebGadget v3

Post by JHPJHP »

Hi skinkairewalker,

Yes, but a 32-bit compiled executable can only run in an x86 Windows environment; same for a 64-bit compiled executable.

----------------------------------------------

Updated:
- various framework optimizations
- various example improvements
- squashed a couple bugs

Image
Last edited by JHPJHP on Fri Jun 02, 2023 2:35 pm, edited 4 times in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium WebGadget v3

Post by JHPJHP »

Updated:
- renamed Cr_WebSocket_Close to Cr_WebGadget_Close
- removed some framework Procedures
- added some framework Procedures
- modified most framework Procedures

NOTE: Included script by luis: HTMLEncoder / HTMLDecoder; currently used in the example CrWG_TabBar.pb.

Cr_WebGadget_Close
1. Rename Cr_WebSocket_Close to Cr_WebGadget_Close.
2. Cr_WebGadget_Close now requires the crwg_data\hWnd parameter.
3. Each Chromium WebGadget now requires a call to Cr_WebGadget_Close.

Due to the framework changes this is a recommended update.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium WebGadget v3

Post by JHPJHP »

Updated:
- various improvements to CrWG_TabBar.pb

NOTE: CrWG_TabBar.pb is an advanced example not meant to be used as a replacement browser, but to demonstrate some additional features.

CrWG_TabBar.pb
Improved the algorithm to identify and retrieve a websites favicon.
Added filters to the Target.setDiscoverTargets method.
Numerous other improvements.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium WebGadget v3

Post by JHPJHP »

Updated:
- various improvements to CrWG_TabBar.pb

CrWG_TabBar.pb
Replaced the Runtime.runScript method with Page.addScriptToEvaluateOnNewDocument.
Replaced the algorithm to identify and retrieve a websites favicon.
Improved the History window and the use of icons.

Previously, I spent a day optimizing the Runtime.runScript method and writing a download favicon algorithm. No sooner do I finish and post the update, I find a less complicated solution for script execution and a much simpler method for downloading favicons.

Image
Last edited by JHPJHP on Fri Jun 02, 2023 4:24 pm, edited 6 times in total.
User avatar
blueb
Addict
Addict
Posts: 1041
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: Chromium WebGadget v3

Post by blueb »

Looking good JHPJHP.

Wishing to try out the new features, I downloaded the EXE version.

The TabBar sample worked well , but the ChartJS sample returns 'file not found'.

It looks as if the sample requires files that are located in my temporary folder.

Of course there aren't any.

Any hints?

PS - I have a program that cleans out my temporary folder every few days.
- It was too lonely at the top.

System : PB 6.10 Beta 9 (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium WebGadget v3

Post by JHPJHP »

Hi blueb,

Thank you for your feedback.

I just realized an option used for testing was still set and has since been removed, but I'm not convinced it's what caused the problem.

It sounds more like an AV issue...
The file created in your Temp folder is flagged as a virus and removed before the program can establish a lock.

Image Image Image

Image Image
Last edited by JHPJHP on Fri Jun 02, 2023 2:28 pm, edited 2 times in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium WebGadget v3

Post by JHPJHP »

Updated:
- renamed CrWG_TabBar.pb to CrWG_Browser.pb
- changes to DevTools Event order in CrWG_Browser.pb and CrWG_Player.pb

DevTools Event Order
Plays an important part in not only optimized script execution but may determine if some scripts get executed.
Calling the Runtime.enable method will not always trigger an event; a simple solution was to execute it last in the event chain.

The example CrWG_Browser.pb has been updated with improvements to the address bar.
1. Doubles as a search bar.
2. Improved Navigation and History buttons.
3. History window tracks current index.

Image Image Image Image
Last edited by JHPJHP on Fri Jun 02, 2023 2:31 pm, edited 4 times in total.
User avatar
❤x1
User
User
Posts: 46
Joined: Thu Jan 10, 2019 5:56 pm

Re: Chromium WebGadget v3

Post by ❤x1 »

Given your recent productivity, I feel I should tell you that you are allowed to sleep. You know that, right?
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium WebGadget v3

Post by JHPJHP »

Hi ❤x1,

Thank you for your post.
Edgar Allan Poe Suspense Essay wrote:“Sleep, those little slices of death — how I loathe them.” ― Edgar Allan Poe.
--------------------------------

Updated:
- removed script not allowing profiles on network shares
- moved two Events from examples to framework Procedures
- added new options
-- #Cr_WebGadget_Network_Warning_Override: Whether or not the browser should warn if the profile is on a network share.
-- #Cr_WebGadget_User_Agent_Override: A string used to override the default user agent with a custom one.
-- #Cr_WebGadget_Language_Code_Override: Two letter language code from ISO-639.
-- #Cr_WebGadget_Enable_Guest_Mode: Causes the browser to launch directly in guest mode.
-- #Cr_WebGadget_Enable_Auto_Accept: Bypass dialog prompting permission to capture camera & microphone.
-- #Cr_WebGadget_Enable_Dark_Mode: Force dark mode on websites that support it.
-- #Cr_WebGadget_Enable_Night_Mode: Forces the night mode to be enabled.
-- #Cr_WebGadget_Enable_Screen_Support: Required for the two new framework Procedures.

Image
Last edited by JHPJHP on Fri Jun 02, 2023 4:24 pm, edited 4 times in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium WebGadget v3

Post by JHPJHP »

Updated:
- CrWG_Browser.pb
-- added Browser Themes
-- added Search Engines
-- various cosmetic improvements
-- squashed a couple bugs
- framework changes and improvements

Browser Themes and Search Engines: Available from the ellipse (...) Options button.

Image Image
Last edited by JHPJHP on Fri Jun 02, 2023 4:23 pm, edited 5 times in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium WebGadget v4

Post by JHPJHP »

The Chromium WebGadget has been updated to version 4

There have been numerous changes, mostly minor improvements, but a couple major updates to warrant a version change.

The ContainerGadget hosting the browser has been replaced with a dynamically created container better suited for the environment.
This update required various changes to the framework and examples, one of which is a new method for opening a Chromium WebGadget.

Another update consisted of moving the Network Event scripts to the framework, reducing the required code for a working example.

In addition, a few framework options have been added and most of the existing ones have been renamed to be more intuitive.

Code: Select all

#Cr_WebGadget_Override_Profile_Location
#Cr_WebGadget_Override_Default_Browser
#Cr_WebGadget_Override_User_Agent
#Cr_WebGadget_Override_Language_Code
#Cr_WebGadget_Override_Network_Warning
#Cr_WebGadget_Override_Camera_Prompt
#Cr_WebGadget_Enable_Guest_Account
#Cr_WebGadget_Enable_Zero_Account
#Cr_WebGadget_Enable_Multiple_Tabs
#Cr_WebGadget_Enable_Screen_Support
#Cr_WebGadget_Enable_Dark_Mode
#Cr_WebGadget_Enable_Night_Mode
#Cr_WebGadget_Idle_Timeout_Minutes
#Cr_WebSocket_Listen_Port_Number
#Cr_WebSocket_Listen_Port_Random
#Cr_WebSocket_Override_Port_InUse
#Cr_WebSocket_Enable_DevTools_Protocol
#Cr_WebSocket_Enable_DevTools_Events
#Cr_WebSocket_Enable_DevTools_Debugger
NOTE: Reviewing the examples should provide most of the information needed to update existing programs or create new ones.
Last edited by JHPJHP on Sun Jun 04, 2023 3:36 am, edited 1 time in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium WebGadget v4

Post by JHPJHP »

This should be my last post for a while concerning CrWG; the changes made today stripped away most of the complicated code.
With exception CrWG_Browser.pb, CrWG_Command.pb and CrWG_Player.pb, written to demonstrate CrWG capabilities.

---------------------------------------------------------

Updated:
- moved common script elements to the framework
- changed some default framework options
- improved the profile location script
- improved the CLS location script
- squashed a PATH bug

Default profile directory and some example stuff: C:\Users\[NAME]\AppData\Roaming\CrWG\.
User-defined command line switches: Same location as executable, switches folder.

Simplest example using the Chromium WebGadget
- the DevTools Protocol is enabled by default, but can easily be disabled

Code: Select all

Enumeration
  #MainWindow
EndEnumeration

#Cr_WebSocket_Enable_DevTools_Protocol = #False

IncludeFile "..\Shared Files\includes\Cr_WebGadget.pbi"

If OpenWindow(#MainWindow, 0, 0, 800, 500, "Chromium WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  crwg_data.CrWG_DATA
  crwg_data\Container = Cr_WebGadget(0, 0, 800, 500, #MainWindow)
  crwg_data\StartURL = "https://www.youtube.com"
  Cr_WebGadget_Init(crwg_data, #PB_Compiler_Filename)

  Repeat
    Event = WaitWindowEvent()

    Select Event
      Case #PB_Event_CloseWindow
        Cr_WebGadget_Close(crwg_data\hWnd)
        Break
    EndSelect
  ForEver
EndIf
NB*: Free executables (x86/x64) were updated and can be downloaded from My PureBasic Stuff; see FREE STUFF.
Last edited by JHPJHP on Mon Jun 05, 2023 4:25 pm, edited 1 time in total.
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Chromium WebGadget v4

Post by Caronte3D »

JHPJHP wrote: Sat Jun 03, 2023 9:15 pm This should be my last post for a while concerning CrWG;
Already too much effort in this beautiful project.
Now you can pass to the next one :D
Locked