Cruisers Forum
 


Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 11-12-2021, 00:10   #46
Registered User

Join Date: Dec 2011
Posts: 27
Re: JavaScript Plugin

Hi,
I note the request to transfer to a new thread but directly responding...
The JavaScript Autorun entry in opencpn.ini is set to 0.
I will test the patched version as time allows.
Thanks for the responses
Cheers,
Ted
tedcoats is offline   Reply With Quote
Old 20-12-2021, 10:37   #47
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,714
Images: 2
Re: JavaScript Plugin

Tony, do you have any thoughts about log4j and how to protect us all?
Since it does run on java.
rgleason is offline   Reply With Quote
Old 20-12-2021, 11:05   #48
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 315
Re: JavaScript Plugin

Quote:
Originally Posted by rgleason View Post
Tony, do you have any thoughts about log4j and how to protect us all?
Since it does run on java.
Log4J is a Java application widely used for logging messages on, inter alia, Apache web servers. A concerning zero-day vulnerability has been found in it.

This is not relevant to the JavaScript plugin. JavaScript is quite different and distinct from Java. Further, the plugin executes scripts internally within the plugin and does not run any JavaScript on the server. So the plugin is immune to any vulnerabilities in JavaScript running on servers.
Antipole is offline   Reply With Quote
Old 20-12-2021, 15:19   #49
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,714
Images: 2
Re: JavaScript Plugin

Good, thankyou.
rgleason is offline   Reply With Quote
Old 21-12-2021, 02:03   #50
Registered User

Join Date: Jul 2010
Location: Hannover - Germany
Boat: Amel Sharki
Posts: 2,546
Re: JavaScript Plugin

I don't know however in which way the log4j problem is involved into the now used way to build OpenCPN and its plugins with ci or flatpak and others.
When using e.g. the original compiler IDE from Apple the Xcode informations has this clarification:
Quote:
Xcode contains a copy of the log4j library that has the CVE-2021-44228 security vulnerability. Xcode automatically downloads an updated version of this library and installs it into ~/Library/Caches/com.apple.amp.itmstransporter. When submitting apps to the App Store, Xcode uses the updated version of the library. (86390060)
CarCode is offline   Reply With Quote
Old 13-01-2022, 06:08   #51
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,714
Images: 2
Re: JavaScript Plugin

Housekeeping Script by antipole


Carcode. thanks.
rgleason is offline   Reply With Quote
Old 05-02-2022, 09:23   #52
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 315
Smile JavaScript Plugin is now at production release v 1.0

The JavaScript plugin is now out of beta and fully released as v1.0.
It is available in the plugins master catalog for installation.

Documentation:
Plugin's manual page.
The User Guide can be downloaded from there.

Minor functional changes since v0.5:
  • The script and results panes now soft-wrap long lines at the pane boundary.
  • Text in dialogues can be styled with font monospace so that tabulated data works better.
Antipole is offline   Reply With Quote
Old 05-02-2022, 10:03   #53
Registered User

Join Date: Sep 2012
Location: Baikal
Posts: 584
Re: JavaScript Plugin

I would like to know what is the practical application of this plugin for a non-programmer user?
Or what opportunities open up?
Baikal is offline   Reply With Quote
Old 05-02-2022, 10:16   #54
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 315
Re: JavaScript Plugin

Quote:
Originally Posted by Baikal View Post
I would like to know what is the practical application of this plugin for a non-programmer user?
Or what opportunities open up?
There is a practical example on the manual page.

It can be used by programmers to create scripts for others to use. See the script library for some examples.

Non-programmer? Scripting in this plugin is far far far easier for a non-programmer to venture in than the complexities of C++ or creating your own plugin. Try copying the example from the manual page and play with it.
Antipole is offline   Reply With Quote
Old 05-02-2022, 10:18   #55
Registered User

Join Date: Sep 2012
Location: Baikal
Posts: 584
Re: JavaScript Plugin

Quote:
Originally Posted by Antipole View Post
There is a practical example on the manual page.

It can be used by programmers to create scripts for others to use. See the script library for some examples.

Non-programmer? Scripting in this plugin is far far far easier for a non-programmer to venture in than the complexities of C++ or creating your own plugin. Try copying the example from the manual page and play with it.
Thanks! I will study!
Baikal is offline   Reply With Quote
Old 08-03-2022, 13:31   #56
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 315
JavaScript plugin v1.1 released

V1.1 is available through the plugin manager.

Output pane
  • The output pane is now scrolled, so that the last output is always visible.
  • The output length is now limited to 100,000 characters to avoid a rogue script exhausting memory and compromising OpenCPN functioning. If the output exceeds this, text is deleted from the top of the pane and a message inserted to indicate that this has happened.
Fixes
  • Sending a message to OCPN_DRAW_PI was causing a crash. Because of the way OD processes messages, this cannot be supported. It will now throw an error.
  • A check is now made to avoid a called back function being invoked while any other JavaScript code is being executed. This is generalised protection against situations such as above.
  • Some dialogue elements require or accept a list of values. An empty list could lead to a crash. Now an error is thrown.
  • Dialogue multi-line text fields now soft-wrap so long lines are readable.
  • When adding or updating a route, a routepoint without a GUID was not being allocated a new GUID. Now it is.
  • onExit( ) was not being lexed blue in the script pane.

User Guide
  • Error in documentation of track structure corrected.
  • Added that with functions such as consoleClearOutput(), if the console name is omitted, it operates on its own console.
Antipole is offline   Reply With Quote
Old 09-03-2022, 16:32   #57
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,714
Images: 2
Re: JavaScript Plugin

Note: Ocpn_Draw supports ODAPI a messaging system. Weather_routing, Watchdog and Squiddio use ODAPI and communicate with Ocpn_Draw. Email Jon Gough if you are interested in it.
rgleason is offline   Reply With Quote
Old 05-04-2022, 03:24   #58
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 315
JavaScript Plugin and layers

The JavaScript plugin allows retrieval and manipulation of waypoints, routes and tracks. When an objects is fetched, there is no indication whether it is in a layer.

It is said that layers are immutable. This is enforced by there being no way of changing an object in a layer in the Route & Mark Manager. This is not enforced in the APIs and a script can in fact change a layer object and this will be reflected in what is seen on the canvas. However, these changes are not saved when OpenCPN exits and they are lost.

Not knowing whether an object is in a layer is causing problems for scripts. If you have layers and are using scripts to access these objects, you need to be aware of this.

I have raised a request on FlySpray for the APIs to be enhanced to include a flag indicating whether an object is in a layer. Please vote for this.

As a work-around, I have had to hide a tag in layer object names ("#layer") so that scripts can avoid inappropriate action on layers.

Although this issue has shown up in the JavaScript plugin, it is not limited to it. Any plugin using these APIs will encounter it.
Antipole is offline   Reply With Quote
Old 05-04-2022, 07:39   #59
3cp
Registered User

Join Date: Jul 2016
Posts: 10
Re: JavaScript Plugin

I don't knowif this is the right place, but i do have a serious problem with the plugin when i am using the OCPNpushNMEA(result); method. OCPN crashes. Here is my code:

OCPNonNMEAsentence(processNMEA);

var direction;

function processNMEA(input){
if (input.OK){
sentence = input.value;
if (sentence.slice(3,6) == "HDG")
{
splut = sentence.split(",");
print("NMEA1 : ", sentence, "\n");
direction = Number(splut[1]) +Number(30);
splut[1] = direction;
result = splut.join(",");
print("NMEA2 : ", result, "\n");
// OCPNpushNMEA(result);
}

}
OCPNonNMEAsentence(processNMEA);
};

Can anyone help me. Is ita bug in the plugin or is my code there's buggy.
3cp is offline   Reply With Quote
Old 05-04-2022, 13:01   #60
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 315
Re: JavaScript Plugin

@3cp… please raise an issue on FlySpray here.

Please include in your issue:
  • The platform you are on
  • Output from your print statements
  • Trace back from the crash report

Thanks
Antipole is offline   Reply With Quote
Reply

Tags
plug, plugin


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JavaScript Plugin for OpenCPN? Antipole OpenCPN 2 16-02-2022 06:44
OpenCPN PlugIn Development bdbcat OpenCPN 161 04-09-2019 12:50
Plugin development... How to receive chart objects in my plugin? dmartinez OpenCPN 6 04-08-2017 00:56
Winlink Express problems with GRIB map and Javascript Slow Boat To... Marine Electronics 0 29-04-2017 14:23
Driving Revenue JavaScript S/V_Surya Forum Tech Support & Site Help 22 06-04-2011 12:26

Advertise Here


All times are GMT -7. The time now is 08:22.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.