Add test sever

This commit is contained in:
Anton Vakhrushev 2018-08-23 09:49:40 +03:00
parent a10e24198e
commit 8d0cf41d73
3 changed files with 19 additions and 1 deletions

View File

@ -12,7 +12,8 @@
"permissions": [
"activeTab",
"notifications",
"tabs"
"tabs",
"<all_urls>"
],
"background": {
"scripts": ["postify.js"]

View File

@ -1,4 +1,5 @@
const APP_NAME = 'Postify';
const SERVER_ADDR = 'http://127.0.0.1:9999';
function sendUrl(url) {
browser.notifications.create({
@ -7,6 +8,17 @@ function sendUrl(url) {
"title": APP_NAME,
"message": url,
});
fetch(SERVER_ADDR, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: url
})
});
}
function sendCurrentUrl(args) {

5
server.php Normal file
View File

@ -0,0 +1,5 @@
<?php
ob_start();
var_dump(file_get_contents('php://input'));
error_log(ob_get_clean(), 4);