feat: add boss key

This commit is contained in:
Draculabo authored and vin committed 2026-01-10 01:07:09 +08:00
1 parent e7087bc4b1
commit bc775d4fd6
10 files changed
+168 -6

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
import { os } from '@orpc/server';
import { z } from 'zod';
import { networkInterfaces } from 'os';
export const systemHandler = os.route({
get_local_ip: os.handler(async () => {
const nets = networkInterfaces();
const results: string[] = [];
for (const name of Object.keys(nets)) {
for (const net of nets[name] || []) {
// Skip over non-IPv4 and internal (i.e. 127.0.0.1) addresses
if (net.family === 'IPv4' && !net.internal) {
results.push(net.address);
}
}
}
return results.length > 0 ? results[0] : '127.0.0.1';
}),
});