Skip to content

Commit

Permalink
implement usage.users.total
Browse files Browse the repository at this point in the history
  • Loading branch information
NishiOwO committed Feb 23, 2025
1 parent 719a6ad commit 3741a3e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/class/HBDatabase.pp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ destructor THighballDB.Destroy();
Query.ExecSQL();
Transaction.Commit();
end;
Query.Free();
Transaction.Free();
Connection.Free();
Query.Free();
inherited;
end;

Expand Down
10 changes: 8 additions & 2 deletions src/route/HBNodeinfo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ implementation
uses
FPJSON,
HighballConfig,
HighballVersion;
HighballVersion,
HBDatabase;

procedure TRouteNodeinfo.Job();
var
EPName: String;
DB: THighballDB;
begin
EPName := RouteReq.RouteParams['name'];
if (EPName = '2.0') or (EPName = '2.1') then
Expand Down Expand Up @@ -51,8 +53,12 @@ procedure TRouteNodeinfo.Job();

RouteJSON.Objects['usage'] := TJSONObject.Create();
// TODO: Return usage.localPosts

RouteJSON.Objects['usage'].Objects['users'] := TJSONObject.Create();
// TODO: Return usage.users.total
DB := THighballDB.Create();
DB.Run('SELECT * FROM users');
RouteJSON.Objects['usage'].Objects['users'].Integers['total'] := DB.Query.RecordCount;
DB.Free();
end
else
begin
Expand Down

0 comments on commit 3741a3e

Please sign in to comment.