Jaehyuk-Lee / DFAssist

FFXIV Duty Finder & F.A.T.E. Assist
https://jaehyuk-lee.github.io/DFAssist
The Unlicense
47 stars 23 forks source link

Feature: Send HTTP POST request #23

Open Makar8000 opened 5 years ago

Makar8000 commented 5 years ago

It would be nice if an advanced option would be added to send an HTTP POST request to a configured URL, so that we can customize our own behavior when an action happens. Example use cases include sending push notifications, discord messages, etc.

Jaehyuk-Lee commented 5 years ago

I was planning restoring twitter alarm feature. But as that feature requires a server, I think your idea is better for now. I'm in bad circumstances to have my own server now. I'll add HTTP POST request feature later, expecting to add it in 2 months.

Jaehyuk-Lee commented 5 years ago

I'm planning to send request on duty matched and fate occured. Sends status (duty-matched or fate-occured) and info(duty name or fate name) I think if users need additional custom request like discord ID or twitter ID, add those information on url and get GET request is better to customize variously.

Also, I think sending POST 'status' String like duty-matched or fate-occured is better than sending status code like 10(on duty) or 20(on fate). How do you think?

Jaehyuk-Lee commented 5 years ago

I thought I could do POST and GET simultaneously by adding like http://{URL}?var1=var1 in the back of the url, but they are not seem to work.(I've tested server in node.js. Maybe it could work in PHP.) I've finished POST function and refining it now. I'm concerning about how to send more parameters to custom target server like I've written before about discord ID or twitter account.

Jaehyuk-Lee commented 5 years ago

I'm planning to release new version tomorrow or the day after tomorrow.

This feature will display like this.

제목 없음

제목 없음2

"name":"name" will be "name":"{instance.Name}" or "name":"{fate.Name}" when it's working on real situation. (I was testing it, I cannot execute game in this situation.)

Below, sample code I used for test in node.js.

const express = require('express');
const bodyParser = require('body-parser');
const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());

let PORT = 3000;

app.post('/test-page', function(req, res) {
    var status = req.body.status,
        name = req.body.name;
    if(status == "duty-matched")
        console.log(name + " matched!");
    else if(status == "fate-occured")
        console.log(name + " occured!");
    res.send("response!");
});

app.listen(PORT, function(){
    console.log("Listening to port " + PORT);
})
Makar8000 commented 5 years ago

Well, one idea would be to have some kind of .json file that specifies additional params to add to your request. Another idea that is more UI based would be to have some kind of item list (similar to REST clients like Postman)

Also, thanks for looking into this idea. It is greatly appreciated!

Jaehyuk-Lee commented 5 years ago

I've released a new version, but I think function and UI have to be improved much more. So, I'll keep this issue opened.

Jaehyuk-Lee commented 5 years ago

@Makar8000 I thought that Postman item list would be great, but I couldn't find anything like that in Windows Form components. What I'm thinking now is to use combo box with add button and delete button. Editable textbox aside to edit. I'm thinking like this. this

Makar8000 commented 5 years ago

That seems like a good alternative to me.