···2020 #stmt_admin_expire_secret;
2121 #stmt_admin_get_secrets;
2222 #stmt_admin_secret_accounts;
2323+ #stmt_admin_nonsecret_accounts;
23242425 #transactionally;
2526 #db;
···137138 unixepoch(max(p.last_push)) * 1000 as 'last_push'
138139 from accounts
139140 left outer join push_subs p on (p.account_did = did)
140140- where secret_password = ?
141141+ where secret_password = :password
142142+ group by did
143143+ order by first_seen desc`);
144144+145145+ this.#stmt_admin_nonsecret_accounts = db.prepare(
146146+ `select did,
147147+ unixepoch(first_seen) * 1000 as 'first_seen',
148148+ role,
149149+ count(*) as 'active_subs',
150150+ sum(p.total_pushes) as 'total_pushes',
151151+ unixepoch(max(p.last_push)) * 1000 as 'last_push'
152152+ from accounts
153153+ left outer join push_subs p on (p.account_did = did)
154154+ left outer join top_secret_passwords s on (s.password = secret_password)
155155+ where s.password is null
141156 group by did
142157 order by first_seen desc`);
143158···204219 }
205220206221 getSecretAccounts(secretPassword) {
207207- return this.#stmt_admin_secret_accounts.all(secretPassword);
222222+ return this.#stmt_admin_secret_accounts.all({ password: secretPassword });
223223+ }
224224+225225+ getNonSecretAccounts() {
226226+ return this.#stmt_admin_nonsecret_accounts.all();
208227 }
209228}