This repository has been archived by the owner on Mar 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
76 lines (67 loc) · 1.81 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
if ((isset($_POST) && !empty($_POST)) or (isset($_GET) && !empty($_GET))) {
if($_GET['request']=='firetext_variables'){
// Firetext 0.5+
// Variable container
$firetextVariables = [];
// Cloud services
$firetextVariables["services"] = [];
// Dropbox config
if (isset($_ENV['dropboxKey'])) {
$firetextVariables["services"]["dropbox"] = [
"authURL"=>"https://firetext-server.herokuapp.com/auth/dropbox/oauth2/",
"apiKey"=>$_ENV['dropboxKey']
];
}
// Splunk config
if (isset($_ENV['splunkKey'])) {
$firetextVariables["services"]["splunk"] = [
"apiKey"=>$_ENV['splunkKey']
];
}
// In-app urls
$firetextVariables["urlCategories"] = [
];
$firetextVariables["urls"] = [
[
"id"=>"rate-firetext",
"name"=>"Rate Firetext",
"url"=>"https://marketplace.firefox.com/app/firetext/ratings/add",
"category"=>""
]
];
// Notifications
$firetextVariables["notifications"] = [];
if($_POST["locale"] == "en") {
array_push($firetextVariables["notifications"],[
"name"=>"test",
"content"=>"want-feedback",
"repeat"=>2
]);
}
// Echo variables
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
echo json_encode($firetextVariables);
exit;
} else if($_POST['request']=='urls') {
// Firetext 0.4-
// Dropbox config
$dropboxURL = 'https://firetext-server.herokuapp.com/auth/dropbox/';
// Create variables
$urls = array(
"about"=>"",
"credits"=>"",
"support"=>"",
"rate"=>"https://marketplace.firefox.com/app/firetext/ratings/add",
"dropboxAuth"=>$dropboxURL
);
// Echo variables
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
echo json_encode($urls);
exit;
}
} else {
echo "Firetext server";
}