Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

anniemaybytes/chihaya #60

Open
wants to merge 40 commits into
base: production
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
0006bdc
empty
pjc09h Apr 11, 2023
478cb5f
Merge branch 'production' of github.com:biotorrents/gazelle into chihaya
pjc09h Apr 12, 2023
1000108
Merge branch 'production' of github.com:biotorrents/gazelle into chihaya
pjc09h May 12, 2023
7e1c3ee
login query hotfix
pjc09h May 17, 2023
fc023a0
update composer
pjc09h May 19, 2023
cd2cb37
Merge branch 'production' of github.com:biotorrents/gazelle into crea…
pjc09h May 20, 2023
2e62b13
silly laravel
pjc09h May 20, 2023
e2c8a7f
long-forlorn api
pjc09h May 20, 2023
0c0d036
improve binary handling a bit
pjc09h May 20, 2023
032d30a
upsert
pjc09h May 20, 2023
abd9cdb
it works
pjc09h May 20, 2023
a222f88
pseudo orm
pjc09h May 20, 2023
e60b07b
put the cache key algorithm in one place
pjc09h May 20, 2023
153a0b9
fix the internal api
pjc09h May 20, 2023
f995aba
bearer token scopes ground work
pjc09h May 20, 2023
3d549c1
cleanup
pjc09h May 20, 2023
a22a3d3
refactor, but there's a bug in token validation
pjc09h May 20, 2023
960267c
various optimizations
pjc09h May 20, 2023
0b17ee0
improve token scopes
pjc09h May 20, 2023
70ceeb7
start implementing a real api response spec
pjc09h May 20, 2023
66f1fbf
use application/vnd.api+json
pjc09h May 20, 2023
dccc822
add openapi.json
pjc09h May 20, 2023
68583c8
start fleshing out an openapi spec
pjc09h May 20, 2023
d1d6023
Merge branch 'creatorObjects' of github.com:biotorrents/gazelle into …
pjc09h May 20, 2023
7ad2e8e
openapi stuff
pjc09h May 20, 2023
846eafb
base responses
pjc09h May 20, 2023
47cb1b9
start crudding stuff up for real
pjc09h May 21, 2023
9d43886
clean out the old api
pjc09h May 21, 2023
9d922d0
mock up some more crud stuff
pjc09h May 21, 2023
481c28e
more crud scaffolding
pjc09h May 21, 2023
f65896d
empty commit
pjc09h May 28, 2023
b15f178
Merge branch 'development' of github.com:biotorrents/gazelle into chi…
pjc09h May 28, 2023
12f059e
add schema file
pjc09h May 28, 2023
70c1d3a
draft migration
pjc09h May 28, 2023
8c87cc3
fix
pjc09h May 29, 2023
5089c35
now to fix all the inevitable bugs
pjc09h May 29, 2023
34307c3
fix client whitelist
pjc09h May 29, 2023
2447424
fix the misc values thing
pjc09h May 29, 2023
1b1057c
"fix" the service stats
pjc09h May 29, 2023
5508efe
more little deletions
pjc09h May 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cleanup
  • Loading branch information
pjc09h committed May 20, 2023
commit 3d549c1f26219c04a11fd20a12855134763b786a
58 changes: 0 additions & 58 deletions app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -786,64 +786,6 @@ public static function uploadSource(): string
}


/**
* createApiToken
*
* @see https://github.com/OPSnet/Gazelle/commit/7c208fc4c396a16c77289ef886d0015db65f2af1
*/
public function createApiToken(int $id, string $name, string $key): string
{
$app = \Gazelle\App::go();

$suffix = sprintf('%014d', $id);
$token = base64UrlEncode(Crypto::encrypt(random_bytes(32) . $suffix, $key));
$hash = password_hash($token, PASSWORD_DEFAULT);

/*
# prevent collisions with an existing token name
while (true) {
$token = base64UrlEncode(Crypto::encrypt(random_bytes(32) . $suffix, $key));
$hash = password_hash($token, PASSWORD_DEFAULT);

if (!$this->hasApiToken($id, $token)) {
break;
}
}
*/

$query = "insert into api_tokens (userId, name, token) values (?, ?, ?)";
$app->dbNew->do($query, [$id, $name, $hash]);

return $token;
}


/**
* hasTokenByName
*/
public function hasTokenByName(int $id, string $name)
{
$app = \Gazelle\App::go();

$query = "select 1 from user_api_tokens where userId = ? and name = ?";
$good = $app->dbNew->single($query, [$id, $name]);

return $good;
}


/**
* revokeApiTokenById
*/
public function revokeApiTokenById(int $id, int $tokenId)
{
$app = \Gazelle\App::go();

$query = "update user_api_tokens set revoked = 1 where userId = ? and id = ?";
$app->dbNew->do($query, [$id, $tokenId]);
}


/** security stuff */


Expand Down
10 changes: 0 additions & 10 deletions sections/user/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@
require_once 'take_edit.php';
break;

/*
case '2fa':
require_once '2fa.php';
break;
*/

case 'invitetree':
require_once 'invitetree.php';
break;
Expand Down Expand Up @@ -130,10 +124,6 @@
require_once serverRoot.'/sections/user/points.php';
break;

case 'token':
require_once __DIR__ . '/token.php';
break;

default:
if (isset($_REQUEST['id'])) {
require_once serverRoot.'/sections/user/user.php';
Expand Down
107 changes: 0 additions & 107 deletions sections/user/token.php

This file was deleted.