*/
public static function rawContent(array $parameters = [])
{
+ $uid = self::getCurrentUserID();
+
if (empty($parameters['id']) && empty($parameters['name'])) {
DI::mstdnError()->UnprocessableEntity();
}
}
}
- $account = DI::mstdnAccount()->createFromContactId($id, self::getCurrentUserID());
+ $account = DI::mstdnAccount()->createFromContactId($id, $uid);
System::jsonExit($account);
}
}
DI::mstdnError()->UnprocessableEntity();
}
- $cid = Contact::follow($parameters['id'], self::getCurrentUserID());
+ $cid = Contact::follow($parameters['id'], $uid);
System::jsonExit(DI::mstdnRelationship()->createFromContactId($cid, $uid)->toArray());
}
*/
public static function rawContent(array $parameters = [])
{
+ $uid = self::getCurrentUserID();
+
if (empty($parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
$params = ['order' => ['uri-id' => true], 'limit' => $request['limit']];
- $uid = self::getCurrentUserID();
-
if (!$uid) {
$condition = ['author-id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED],
'uid' => 0, 'network' => Protocol::FEDERATED];
public static function delete(array $parameters = [])
{
self::login(self::SCOPE_WRITE);
-
$uid = self::getCurrentUserID();
if (empty($parameters['id'])) {
public static function post(array $parameters = [])
{
self::login(self::SCOPE_WRITE);
-
- $uid = self::getCurrentUserID();
+ $uid = self::getCurrentUserID();
$request = self::getRequest([
'title' => '',
*/
public static function rawContent(array $parameters = [])
{
+ $uid = self::getCurrentUserID();
+
if (empty($parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- System::jsonExit(DI::mstdnStatus()->createFromUriId($parameters['id'], self::getCurrentUserID()));
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($parameters['id'], $uid));
}
}
}
/**
- * Log in user via OAuth or Simple HTTP Auth.
- *
- * Simple Auth allow username in form of <pre>user@server</pre>, ignoring server part
+ * Log in user via OAuth or Basic HTTP Auth.
*
* @param string $scope the requested scope (read, write, follow)
- *
- * @throws HTTPException\ForbiddenException
- * @throws HTTPException\UnauthorizedException
- * @throws HTTPException\InternalServerErrorException
- * @hook 'authenticate'
- * array $addon_auth
- * 'username' => username from login form
- * 'password' => password from login form
- * 'authenticated' => return status,
- * 'user_record' => return authenticated user record
*/
protected static function login(string $scope)
{