rejetto forum

Ways to trigger events at a specific file download/ request

Fenn · 6 · 1439

0 Members and 1 Guest are viewing this topic.

Offline Fenn

  • Occasional poster
  • *
    • Posts: 3
  • I don't know how to code
    • View Profile
I'm trying to figure out a way to run a specific script by form of [request] or [download] but not any download or request but if a specific directory/ file is accessed.
i have looked though a bunch of threads and i could never find highly detailed information or a manual to use the hfs.events file
if anyone has done this please help
Thanks
I still don't know how to code


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13438
    • View Profile
hi, and welcome!
the idea is that inside the [whatever] you can decide your action based on the url. For example

[request]
{.if|{.pos|/asd|%url%.}|{:{.disconnect.}:}.}



this disconnects, but you can do something else


Offline Fenn

  • Occasional poster
  • *
    • Posts: 3
  • I don't know how to code
    • View Profile
Thanks for the reply!
What i am trying to do is basically use HFS as a simple API.
what i am trying to do is send a request to a file through the link including arguments that my application is going to send.
which is going to run a php script that would send a message through a discord bot that would then display a users game status and his nickname
And i am wondering if that is possible to do using HFS since ive wanted to move over to a personal host instead amazon/ google hackery and paid services
I still don't know how to code


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13438
    • View Profile
HFS doesn't support PHP.
Still you can use HFS to execute a file (with parameters) when a specific url is requested, by using the {.exec.} command.
Yet, this is hardly what HFS is designed for, so if that's your only goal you may find better solutions.
You can replace the disconnect command in my example with exec, that is documented here
https://rejetto.com/wiki/index.php/HFS:_scripting_commands#Others

hfs' scripting language is quite bad, but it's all you got on hfs :)


Offline Fenn

  • Occasional poster
  • *
    • Posts: 3
  • I don't know how to code
    • View Profile
Thanks ill look into that and probably try running another app alongside HFS if it doesnt work

since im already running a file server that lets the my app download things remotely
You can actually check it out using my ip. since i dont really want to reveal its domain link.
as far as i know its a read-only file server
« Last Edit: January 25, 2022, 02:53:03 PM by Fenn »
I still don't know how to code


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13438
    • View Profile
yes, i can see it running with your ip.
HFS is by default read-only.
There's no way for me to know that you didn't create an account that once logged in can upload or delete stuff, but I assume from your words that you didn't do it.

Be careful exposing your php files, or other files that may contain sensible informations.
A php file in HFS is just a text file where people can read your source.
You may expect that it is executed and only its output is visible, but that's not true in HFS (because it doesn't support PHP)