消息推送和第三方接收后台搭建,未测试

This commit is contained in:
not-like-juvenile
2026-02-25 09:38:01 +08:00
parent 1ad4d05ffb
commit 0762857434
11 changed files with 1571 additions and 24 deletions

28
server/probe_supa.js Normal file
View File

@@ -0,0 +1,28 @@
const fetch = require('node-fetch')
const SUPA = process.env.SUPA_URL || process.env.SUPA || 'http://192.168.1.62:18000'
// 支持两种环境变量名SUPA_KEY 或 SERVICE_ROLE_KEY自托管 .env 里常见)
const KEY = process.env.SUPA_KEY || process.env.SERVICE_ROLE_KEY || 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoic2VydmljZV9yb2xlIiwiaXNzIjoic3VwYWJhc2UtMSIsImlhdCI6MTc2OTY3NjQ5OCwiZXhwIjoxOTI3MzU2NDk4fQ.ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
const USER = 'a8e3a568-fc1f-4237-bcc5-5722e2fca0a3';
(async () => {
try {
const url = `${SUPA.replace(/\/$/, '')}/rest/v1/push_devices?user_id=eq.${encodeURIComponent(USER)}`
console.log('GET', url)
const resp = await fetch(url, {
method: 'GET',
headers: {
apikey: KEY,
Authorization: `Bearer ${KEY}`,
Accept: 'application/json'
},
timeout: 10000
})
console.log('status', resp.status)
const txt = await resp.text()
console.log('body:', txt)
} catch (e) {
console.error('probe error', e && e.message ? e.message : e)
process.exit(1)
}
})()