Compare commits
2 Commits
63532c54ea
...
073fba5312
Author | SHA1 | Date |
---|---|---|
Sascha Nitsch | 073fba5312 | |
Sascha Nitsch | 47f82afcb5 |
|
@ -38,13 +38,13 @@ To configure an apache server, add the following rewrite rules:
|
||||||
<Directory /where/ever/you/put/it>
|
<Directory /where/ever/you/put/it>
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
RewriteBase /
|
RewriteBase /
|
||||||
RewriteRule ^api/(.+)$ api.php?_call=$1 [L]
|
RewriteRule ^api/federator/(.+)$ federator.php?_call=$1 [L]
|
||||||
RewriteRule ^(\.well-known/.*)$ /api.php?_call=$1 [L,END]
|
RewriteRule ^(\.well-known/.*)$ /federator.php?_call=$1 [L,END]
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
With the dummy plugin and everything installed correctly a
|
With the dummy plugin and everything installed correctly a
|
||||||
|
|
||||||
> curl -v http://localhost/api/v1/dummy/moo -H "X-Session: somethingvalid" -H "X-Profile: ihaveone"
|
> curl -v http://localhost/api/federator/v1/dummy/moo -H "X-Session: somethingvalid" -H "X-Profile: ihaveone"
|
||||||
|
|
||||||
should return a piece of ascii art.
|
should return a piece of ascii art.
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,8 @@ class User
|
||||||
openssl_pkey_export($private_key, $private);
|
openssl_pkey_export($private_key, $private);
|
||||||
try {
|
try {
|
||||||
$sql = 'insert into users (id, externalid, rsapublic, rsaprivate, validuntil)';
|
$sql = 'insert into users (id, externalid, rsapublic, rsaprivate, validuntil)';
|
||||||
$sql .= ' values (?, ?, ?, ?, now() + interval 1 day) on duplicate key update validuntil=now() + interval 1 day';
|
$sql .= ' values (?, ?, ?, ?, now() + interval 1 day)';
|
||||||
|
$sql .= ' on duplicate key update validuntil=now() + interval 1 day';
|
||||||
$stmt = $dbh->prepare($sql);
|
$stmt = $dbh->prepare($sql);
|
||||||
if ($stmt === false) {
|
if ($stmt === false) {
|
||||||
throw new \Federator\Exceptions\ServerError();
|
throw new \Federator\Exceptions\ServerError();
|
||||||
|
@ -119,8 +120,7 @@ class User
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($cache !== null) {
|
if ($cache !== null) {
|
||||||
print_r($user);
|
if ($user->id === null && $user->externalid !== null) {
|
||||||
if ($user->id === null) {
|
|
||||||
self::addLocalUser($dbh, $user, $_name);
|
self::addLocalUser($dbh, $user, $_name);
|
||||||
}
|
}
|
||||||
$cache->saveRemoteUserByName($_name, $user);
|
$cache->saveRemoteUserByName($_name, $user);
|
||||||
|
|
Loading…
Reference in New Issue