NetTalk Central

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Bruce

Pages: 1 ... 4 5 [6] 7 8 ... 735
76
Web Server - Ask For Help / Re: Email from browse menu button
« on: January 29, 2024, 10:41:30 PM »
I think you need to define what you mean by "send an email".
Is there any user interface here? or is it an automated background send?

77
Web Server - Ask For Help / Re: Help with NT 14.13 API
« on: January 29, 2024, 10:40:32 PM »
Jeff,
this is likely a good question for the User Group Meeting on Thursday, because I have lots of questions for you.

But basically I start with
"Write your code in the ServiceMethod routine".

In other words write the code to do what you've laid out above. Then the parameters and returns become obvious (since they're used by, or created by, your code).

78
Web Server - Ask For Help / Re: WebCam criteria for reading barcodes
« on: January 29, 2024, 10:35:39 PM »
Hi Ron,

Autofocus, sure. but I think they all have auto-focus.
But resolution matters. Cheap PC webcams are typically very low res compared to say the cameras in most phones.
So if you want to scan barcodes from a PC you need aq camera with "good" resolution.

Cheers
Bruce

79
That's not the real question.
The real question is "how you [safely] trigger the serial device?"

Traditionally browsers are isolated from hardware. So code running in the browser (JavaScript) cannot talk to a serial port, and so trigger your serial device. In this situation you need to run a small program on the client device (the Raspberry Pi) which reads and writes the serial port. Typically this program is also a _web server_ - because then the Browser can create a connection to it, send it a command, and so on.

Thus the browser talks to your main home server, and when it gets the ok to open a locker it triggers a request to the local server which then triggers the serial port.

Now, I say, traditionally, because in recent times there's a serial interface experiment happening in the browser. This means that the browser can interact directly with the serial port using JavaScript. Of course one would need to be very careful taking this approach. Since the browser is the "least secure" part of they system, if you use this API you make it _very_ tempting to attack the browser/Javascript with a view to it simply opening all the lockers.

So I think in a situation like yours, I would lean towards a more sophisticated system - one which relies on an encrypted one-time code being passed to the local server from the home NT server. In this way the home server issues a code which opens the locker. I'd code it something liek this;

a) home server decides a locker must be opened.
b) sends a "get random string" (aka a nonce) command to the browser, which in turn requests it from the local (python or whatever) server.
c) the local python server stores that string for a little bit.
d) the browser passes the string back to the home server, and the home server encrypts it using a private key.
e) the string is then passed back to the browser, and on to the local server. the local server decrypts it using a public key. And compares it to the nonce. If that passes then the instruction is executed. The python program then discards the stored nonce.

This prevents replay attacks (recording the command to open locker 2, then playing it back in the future.) By getting a one-time random nonce from the python program, and then including that in the command, the python program won't replay the command. So for example the command passed to the python server (encrypted) might be
{ "nonce" = "1234",
"cmd" : "open locker",
"locker" : 2}







80
Validation happens in the
ValidateValue::Whatever
routine

81
Web Server - Ask For Help / Re: Add a Save and Continue to edit button
« on: January 24, 2024, 01:19:58 AM »
For the 14.17 build I've added a button type "Partial Save". This saves the record, and leaves the form open in Change mode.

82
post an example, and I'll see what can be done.

83
>> A post from a few years ago mentioned it was not possible to disable a TaskPanel menu item yet, so I was wondering if this is something planned for a future update or a way to do this now?

It isn't planned (at least not on my list) and I haven't done any work in this space for ages, so I presume it hasn't changed.
If you'd like to get it on a list, post in the Feature-Request section of the forums.
(you should likely post an example as well)

84
You'll have to explain more, or post an example.
I'm not sure what you mean by "a lookup button that validates the entry".
buttons don't validate things, so I feel either I don't understand what you are doing, or you're describing it wrong.

85
Hi Hector, this code is "wrong" in a number of ways.
Firstly the options; all you should have is

 net.ContentType ='application/json'
 Net.Authorization ='Bearer KEY01...'

Secondly, the call;

net.SetAllHeadersDefault()
do options
net.SetValue('Testdata', '{{ "from": "+18660000000", "to": "+10000000000", "text": "Hello, world!" }',net:NoUrlEncode,'','')
Net.Post('https://api.telnyx.com/v2/messages')

since there are only 2 options to set, this can be reduced to

net.SetAllHeadersDefault()
 net.ContentType ='application/json'
 Net.Authorization ='Bearer KEY01...'
net.SetValue('Testdata', '{{ "from": "+18660000000", "to": "+10000000000", "text": "Hello, world!" }',net:NoUrlEncode,'','')
Net.Post('https://api.telnyx.com/v2/messages')


the code generated by capesoft.com/curlcode from your curl example suggests;

  net.Start()
  net.SetValue('', '{{    "from": "+13115552368",    "to": "+13115552367",    "text": "Hello, world!"  }',net:NoUrlEncode,'','')
  net.ContentType = 'application/json'
  net.Authorization = 'Bearer YOUR_API_KEY'
  net.Post('https://api.telnyx.com/v2/messages')

which is pretty much the same thing. You added "testdata" to the SetValue,. and I don't think that's required - you should test it both ways.

Cheers
Bruce

86
your condition could be a variable, and you can just set it however you like (to say true or false) before it is used.

ie - inspect the generated code, see where the condition is used, and just add whatever you like before that.

87
Use F12 in your browser to inspect the CSS that is in play. If you'd like me to show you what I mean, come to the User Group meeting on Thursday - it's almost always easier to "show" css than it is to explain it.

88
Web Server - Ask For Help / Re: NT Paths - trying to sort this out
« on: January 23, 2024, 06:37:28 AM »
Hi Ron,

>> I was going to use the SETPATH() once each user logs in and I know their specific folder.  e.g. SeTPATH('C:\User1')  or SetPath('C:\User2').  In this way, they will only see their data.  I know that the NT training book uses Variable file names but I would like to use the Setpath() to get to each data set.

You absolutely cannot use SETPATH to do this. The "current directory" is a non-threaded environment variable. Since multiple users can be logged in at the same time, Environment variables cannot be used at the user level.

>> I know that the NT training book uses Variable file names

you'll be shocked to know, there's a reason for that.

>> Questions: 1. Is using SetPath() a valid approach to do this?

nope.

>>  2. If  User1 is in C:\User1 directory and UPLOADS a file to the server.   Where will it go? 

\web\uploads
(or wherever you direct it to in your code.)

>>  WIll it go to .web\uploads relative to where the App EXE is running

the \web folder is already independent of the exe folder. So there's no web folder "relative" to the exe folder. That doesn't exist.
it will go to the \web\uploads folder though (or to wherever you redirect it to.)

>> or will User 1 have an UpLoads directory in C:\User1

no. the server will not serve to, or from, folders outside the web folder. The _database_ files may of course be anywhere (since their location is determined by the file driver, not the WebServer class). They are unrelated to the\web folder, and putting database files int eh \web\ folder would be very bad.


>> I have the option of making USER 1 and USER 2 folders beneath the web folder so I am not all over the disk - is that preferable?   

For uploads, sure. For database files, not that would be very bad.

Cheers
Bruce

89
Web Server - Ask For Help / Re: Redactor options
« on: January 23, 2024, 06:31:00 AM »
loc:options is not a string, you don't set it like that.
Perhaps look in the generated code to see how loc:options is used.

Cheers
Bruce

90
Web Server - Ask For Help / Re: HTML text not displaying in view form
« on: January 23, 2024, 06:30:14 AM »
are you sure it said <bold> ?
HTML doesn't have a <bold> tag.
(If you are getting that in the html then we could add it as a "safe" tag, but it's not a normal tag.)

Pages: 1 ... 4 5 [6] 7 8 ... 735