initial commit
This commit is contained in:
36
set_temp_avatar.php
Normal file
36
set_temp_avatar.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
$config = include __DIR__ . '/config.php';
|
||||
$internal_pics_dir = realpath(__DIR__ . $config['pics_dir']);
|
||||
$app = new Phlaym\Roastmonday\Roastmonday($config, $internal_pics_dir);
|
||||
|
||||
if (!$app->isAuthenticated()) {
|
||||
$url = $app->getAuthURL();
|
||||
die('{"authenticated":false, "authUrl": "' . $url . '"}');
|
||||
}
|
||||
if (isset($_GET['status'])) {
|
||||
$resp = [
|
||||
'authenticated' => true,
|
||||
'maxPostLength' => $app->getMaxPostLength()
|
||||
];
|
||||
die(json_encode($resp));
|
||||
}
|
||||
if (empty($_POST['submit'])) {
|
||||
$e = ['error' => [
|
||||
'message' => 'Unknown action',
|
||||
]];
|
||||
die(json_encode($e));
|
||||
}
|
||||
$resp = $app->addAvatar(
|
||||
$_POST['theme'],
|
||||
$_POST['shouldPostAvatar'] ?? false,
|
||||
$_FILES['avatar'],
|
||||
$_POST['avatarDuration'],
|
||||
$_POST['posttext'],
|
||||
overwrite_if_exist: true
|
||||
);
|
||||
die(json_encode($resp));
|
Reference in New Issue
Block a user