1
0
mirror of https://github.com/beestat/app.git synced 2025-05-24 02:14:03 -04:00

Removed hardcoded beestat API key

This commit is contained in:
Jon Ziebell 2023-01-18 21:22:12 -05:00
parent d4350d8a90
commit 6158e2c19e
4 changed files with 4 additions and 10 deletions

View File

@ -25,7 +25,7 @@
// If you're not logged in, just take you directly to the ecobee login page.
if(isset($_COOKIE['session_key']) === false) {
header('Location: http://' . $_SERVER['HTTP_HOST'] . '/api/?resource=ecobee&method=authorize&arguments={}&api_key=ER9Dz8t05qUdui0cvfWi5GiVVyHP6OB8KPuSisP2');
header('Location: http://' . $_SERVER['HTTP_HOST'] . '/api/?resource=ecobee&method=authorize&arguments={}&api_key=' . $setting->get('beestat_api_key_local'));
die();
}

View File

@ -9,13 +9,6 @@ beestat.api = function() {
*/
beestat.api.cache = {};
/**
* Beestat's local API key.
*
* @type {string}
*/
beestat.api.api_key = 'ER9Dz8t05qUdui0cvfWi5GiVVyHP6OB8KPuSisP2';
/**
* Send an API call. If the api_call parameter is specified it will send that.
* If not, it will check the cache, then construct and send the appropriate
@ -33,7 +26,7 @@ beestat.api.prototype.send = function(opt_api_call) {
// If passing an actual API call, fire it off!
if (opt_api_call !== undefined) {
// Add in the API key
opt_api_call.api_key = beestat.api.api_key;
opt_api_call.api_key = window.beestat_api_key_local;
this.xhr_.addEventListener('load', function() {
self.load_(this.responseText);

View File

@ -219,7 +219,7 @@ beestat.component.card.contribute_status.prototype.decorate_patreon_ = function(
.set_background_hover_color(beestat.style.color.red.light)
.set_text_color('#fff')
.addEventListener('click', function() {
window.open('../api/?resource=patreon&method=authorize&arguments={}&api_key=ER9Dz8t05qUdui0cvfWi5GiVVyHP6OB8KPuSisP2');
window.open('../api/?resource=patreon&method=authorize&arguments={}&api_key=' + window.beestat_api_key_local);
self.state_.patreon_connecting = true;
self.rerender();
});

View File

@ -4,6 +4,7 @@ require_once 'api/cora/setting.php';
$setting = cora\setting::get_instance();
// Make the environment accessible to JavaScript.
echo '<script>window.beestat_api_key_local = \'' . $setting->get('beestat_api_key_local') . '\';</script>';
echo '<script>window.environment = \'' . $setting->get('environment') . '\';</script>';
echo '<script>window.is_demo = ' . ($setting->is_demo() === true ? 'true' : 'false') . ';</script>';