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 - newbie

Pages: [1] 2
1
HFS ~ HTTP File Server / Re: HFS Scripting cmd: time and filetime
« on: December 03, 2019, 11:35:08 PM »
nm. I figured it out based on the comment here:
https://stackoverflow.com/questions/57184472/javascript-date-to-delphi-tdatetime

A Unix date/time is represented as the number of seconds since January 1 1970 00:00:00 UTC.
Delphi has a UnixDateDelta constant in the SysUtils unit which is defined as 25569, the number of days from December 31 1899 to January 1 1970.

So, using 25569, I was able to convert HFS time|YYYY:MM:DD:HH:NN:SS  to time_t, then do a difftime to get (double) seconds, divide by 86400 to get days, and then add 25569 to get the time in Delphi time.

But just saw your comment %now% works better. Thanks.

2
HFS ~ HTTP File Server / HFS Scripting cmd: time and filetime
« on: December 03, 2019, 11:10:31 PM »
I want to figure out the time difference between current server time and filetime of a file.
From https://www.rejetto.com/wiki/index.php/HFS:_scripting_commands
it looks like:
filetime returns a double value based on Delphi time ie days since 12/30/1899
&
time returns a value based on the optional argument (YY:MM:DD:HH:NN:SS) something like 2019:12:03:18:10:59

How can I get both times in one format, so that I can get the time since the file was created on the server.

3
I am using HFS 2.3m.

I am noticing however, that in some rare instances, HFS will start up as a service just fine, but the permissions will not be set. So AddFolder, Delete etc will not work.

And to reiterate, I am starting it as a service using a VFS that I am copying around which was created by:
- starting HFS on server1, then manually setting the permissions via the Properties page, then saved to a .vfs.
Now, this vfs is loaded across the various machines 1...n in HFS, where HFS is started as a service.

4
HFS ~ HTTP File Server / Re: Get Connections
« on: November 11, 2019, 05:55:33 PM »
Sorry. I am back. I cannot depend on netstat -a anymore.
The machine is going to be host to numerous other servers, and I want to be able to filter out the non-HFS connections.
I'm thinking of collecting the IPs when the clients make the first initialization call to HFS, and removing the IP when the client disconnects.
Unless you'all know of something better.

5
Thanks bmartino1.

But the idea is to avoid any manual step like that...the idea is to start HFS as a service, and whatever's in the tpl (including real folder, permissions etc.) should just take effect, and start on many servers.

However, I did DO something similar, TBH. I started HFS, then manually set the permissions via the Properties page, then saved to a .vfs.
Now, I use this vfs across the various machines to start HFS on them automatically.
Downside is that the path (and thats the full path) is baked into the vfs, so I have to take care that the same drive, folder exists across all the machines.
The above process is working right now, but prevents me from truly running it completely automatically .

6
Anybody else have any thought as to how I can set permissions ....
cause the following in my tpl isnt working...

{.set item|myData|add access=robert.}
{.set item|myData|add upload=robert.}
{.set item|myData|add delete=robert.}

This has turned into a blocker for me.

Thanks

7
I wish to run this on a "clean" machine, ie there is no hfs.ini file at the beginning beside hfs.exe. Right?
Also, there will not be any registry entry  (Computer\HKEY_CURRENT_USER\Software\rejetto\HFS) or a .vfs file.
This whole exercise is to deploy it on multiple machines in as automatic a way as possible.

I am running the hfs.exe in elevated (admin) mode in the cmd prompt like so:
hfs.exe -c reload-on-startup=no\nload-tpl-from=myHFS.tpl F:\Blah\myData

8
Thanks bmartino1.

Since I posted my question, I was able to make my setup a bit more streamline, but the problem remains. Here's what I did:
1. Made a copy of hfs.tpl and called it myHFS.tpl
2. Modified myHFS.tpl to:
 i. add the few scripts I wanted.
 ii. add the user-permissions
[special:import]
{.new account|robert|password=bob|can change password|enabled=1|is group=1|notes=accounts members of this group will be allowed to change their password.}
{.set item|myData|add access=robert.}
{.set item|myData|add upload=robert.}
{.set item|myData|add delete=robert.}

3. In a cmd prompt, ran:
hfs.exe -c reload-on-startup=no\nload-tpl-from=myHFS.tpl F:\Blah\myData

The permissions still remain unset.

So, in answer to your post, I have done what you did essentially...unless it matters that the tpl file is called dif.hfs.tpl.

9
@Rejetto

Any thoughts on why the permissions arent setting when I add the following to the .tpl:
{.set item|myData|add access=robert.}
{.set item|myData|add upload=robert.}
{.set item|myData|add delete=robert.}

Thanks

10
HFS ~ HTTP File Server / Re: Get Connections
« on: October 23, 2019, 08:59:27 PM »
Ok. Thanks. That should work.

11
HFS ~ HTTP File Server / Re: Move cmd via curl
« on: October 23, 2019, 06:30:33 PM »
nm. Got it.
I had the destination wrong.

This works...

curl -u user:passwd "http://hfserver:280/myData/folder1/folder2/?mode=section&id=ajax.move" --data "dst=/myData/folder1/folder3&files=file1.png:file2.png:file3.png"

12
So, I have the followingL
1. myDiffTpl.tpl
[special:import]
{.new account|robert|password=bob|can change password|enabled=1|is group=1|notes=accounts members of this group will be allowed to change their password.}
{.set item|myData|add access=robert.}
{.set item|myData|add upload=robert.}
{.set item|myData|add delete=robert.}

2. myIni.ini
load-tpl-from=myDiffTpl.tpl

and, I call:
hfs.exe -a myIni.ini F:\Blah\myData

HFS opens up with myData published. When I look at myData properties, I see that there is an account called robert with an encrypted password.
However, it appears that the permissions supplied above for access, upload, delete are not checked.
Hence, these operations dont work, until I manually click the permissions on.

Any idea what I am doing wrong.

13
HFS ~ HTTP File Server / Move cmd via curl
« on: October 23, 2019, 03:56:12 PM »
I am trying to move some files via a curl cmd.

I am trying the following:
curl -u user:passwd "http://hfserver:280/myData/folder1/folder2/?mode=section&id=ajax.move" --data "dst=folder1/folder3&files=file1.png:file2.png:file3.png:" 
I am guessing the files values are wrong, but I dont know how they should be separated. Is : the right delimiter there?


I see the following code in HFS source:
function selectedFilesAsStr() {
    var a = [];
    selectedItems().each(function(){
        a.push(getItemName(this));
    });
    return a.join(":");
}
So, its an array and there's an ending :
So, thats why I tried
files=file1.png:file2.png:?

14
HFS ~ HTTP File Server / Get Connections
« on: October 23, 2019, 02:18:01 PM »
I notice that the UI displays a table for Connections with 6 entries for one client.
Is there a way for me to get that list of IP addresses via a script?

There doesnt appear to be a GetConnections here:
https://www.rejetto.com/wiki/index.php/HFS:_scripting_commands#Connections_control

15
HFS ~ HTTP File Server / Re: Firing an event on macro completion
« on: October 23, 2019, 02:09:51 PM »
Those are excellent pointers Rejetto. Thanks for your comments. I didnt know about the MySection technique, but I knew about exec and output.
Either of those will work. I am good here.

Pages: [1] 2