Add test sever
This commit is contained in:
parent
a10e24198e
commit
8d0cf41d73
@ -12,7 +12,8 @@
|
||||
"permissions": [
|
||||
"activeTab",
|
||||
"notifications",
|
||||
"tabs"
|
||||
"tabs",
|
||||
"<all_urls>"
|
||||
],
|
||||
"background": {
|
||||
"scripts": ["postify.js"]
|
||||
|
12
postify.js
12
postify.js
@ -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
5
server.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
ob_start();
|
||||
var_dump(file_get_contents('php://input'));
|
||||
error_log(ob_get_clean(), 4);
|
Loading…
Reference in New Issue
Block a user