rejetto forum
Software => HFS ~ HTTP File Server => Topic started by: Kremlin on October 22, 2009, 03:40:01 PM
-
Hi everyone, it's been a while :) (University..)
So basically i'm trying to figure out how to enforce a premium hour service, as in some folders get automatically locked at a certain time in the day lets say [at 19:00]. These folders should preferably get locked with an already existing account user and pass (this part if flexible). Is there anyway to do so in the 'diff template' sections with the 'if' 'set ini' and 'at' macros? Other suggestions are also welcome.
PS. I do not wish to lock the entire site, just the folders that appear in the site.
-
uses the events (hfs.events)
they accept times events and more ...
http://www.rejetto.com/wiki/index.php/HFS:_Event_scripts
;)
-
with diff templates you may get to hide the files, not showing the list on some hours.
but the best solution is: events + account
-
hmm, when i use set user/pass on a folder with the interface option, is there a way to put that action in form of a macro in the diff template?
I would then use something like,
[at 18:00]
{.set ini|%user%=xxxx ...
-
hmm, when i use set user/pass on a folder with the interface option, is there a way to put that action in form of a macro in the diff template?
I would then use something like,
[at 18:00]
{.set ini|%user%=xxxx ...
events as [at 18:00] are only allowed in hfs.events, not inside a tpl or a diff tpl
time events are tested every minutes
Timed events
You can ask HFS to run a script at a certain time, or interval.
To run a script at 1PM o'clock, you can make an event [at 13:00].
To run every 15 minutes instead you should make an event [every 15 minutes].
scripts and events in hfs
http://www.rejetto.com/forum/index.php?topic=6588.msg1042304#msg1042304
Small reminder about EVENTS and hfs.events
http://www.rejetto.com/forum/index.php?topic=6845.msg1042396#msg1042396
but you know all of that ;)
-
Yeah, I kinda figured that the [at xx:xx] would only work for the events, but with this comes an idea, how about adding an option to the events to only affect certain folders in the hfs tree. For example:
[for /Movies/2009/]
[at 18:00]
{.set ...
[/for]
this way we could use the events in a partial way. Anyway it's just a suggestion for rejetto :P
-
[for /Movies/2009/]
[at 18:00]
{.set ...
[/for]
[at 18:00]
{set item|/Movies/2009|remove access=Kremlin.}
[at 06:00]
{set item|/Movies/2009|add access=Kremlin.}
-
Nevermind rejetto. Mars u rock :)
-
always reading the wiki :D
http://www.rejetto.com/wiki/index.php/HFS:_scripting_commands#Account_manipulation
-
Yet something is missing in a little script i'm making
[unauthorized]
{.if|%password%=||{.append|/template/log.txt|[%date][%ip%] %user%:%password%
.}.}
Keep in mind when i place nothing in front of the =, i mean it not to log when someone has not entered a password. But it still keeps logging it, making the number of lines in the txt file massive :S
-
[unauthorized]
{.if|%password%=||{.append|/template/log.txt|[%date][%ip%] %user%:%password%
.}.}
exactly the same with
[unauthorized]
{.if|%user%%password%|{:{.append|/template/log.txt|
[%date%] [%ip%] %user%:%password%.}:}.}
never forget to quote any macro inside {.if| .... |{: .... :}|{: .... :} .}
-
Figured it out, just bad syntax :P
[unauthorized]
{.if not|{.%password%=.}|{:{.append|/template/log.txt|[%date][%ip] %user%:%password%
.}:}.}
Works like a charm :)
-
you can reduce
{.if not|{.%password%=.}|{:{.
by
{.if|%password%|{:{.
-
Just to conclude the purpose of this thread and if anyone else is interested in something similar, I chose these lines to use in the hfs.events (ALT+F6)
[at 18:00]
{.set ini|speed-limit-ip=5.}
{.set item|/|add access=Administrator.}
[at 18:01]
{.disconnect|192.168.12.1-192.168.12.255.}
[at 00:00]
{.set ini|speed-limit-ip=-1.}
{.set item|/|remove access=Administrator.}
Obviously the 'Administrator' account needs the no limits option, otherwise speed would be very slow :P