DirectorySlash Off
</Files>
-#Disable the next two lines to have static usernames only
+#Disable the next three lines to have static usernames only
+RewriteRule ^api/razer/session$ /api/razer/session.php [END]
RewriteRule ^api/v1/gamers/me$ /api/v1/gamers/me.php [END]
RewriteRule ^api/v1/sessions$ /api/v1/sessions.php [END]
--- /dev/null
+{
+ "token": "00702342-0000-1111-2222-c3e1500cafe1"
+}
--- /dev/null
+<?php
+/**
+ * Store the desired username during the login process
+ *
+ * It will be read by the Razer Forge TV when calling api/v1/gamers/me.
+ *
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @see api/razer/session
+ * @see api/v1/gamers/me
+ */
+
+if (!isset($_POST['email'])) {
+ header('HTTP/1.0 400 Bad Request');
+ header('Content-type: application/json');
+ echo '{"error":{"message":"E-Mail missing","code": 2001}}' . "\n";
+ exit(1);
+}
+$email = $_POST['email'];
+
+//we use the ouya username storage code here
+// and simply use the part before the @ in the e-mail as username.
+list($_POST['username']) = explode('@', $email);
+require __DIR__ . '/../v1/sessions.php';
"settings": {},
"founder": false,
"email": "stouyapi@example.org",
- "username": "stouyapi"
+ "username": "stouyapi",
+ "nickname": "stouyapi",
+ "avatar": null
}
}
* @see api/v1/sessions
*/
$dbFile = __DIR__ . '/../../../../data/usernames.sqlite3';
+$cfgFile = __DIR__ . '/../../../../config.php';
+if (file_exists($cfgFile)) {
+ include $cfgFile;
+}
+
$ip = $_SERVER['REMOTE_ADDR'];
if ($ip == '') {
$data = json_decode(file_get_contents('me.json'));
$data->gamer->username = $row['username'];
+$data->gamer->nickname = $row['username'];
switch (strtolower($row['username'])) {
case 'cweiske':
+ $data->gamer->founder = true;
+ $data->gamer->avatar = $GLOBALS['baseUrl'] . 'avatars/cweiske.png';
+ break;
case 'szeraax':
$data->gamer->founder = true;
+ break;
}
header('Content-type: application/json');
-echo json_encode($data) . "\n";
+echo json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n";
?>