fix 'currently listening' bug
This commit is contained in:
parent
af5b20d3e6
commit
7ed44ac60e
2
server/dist/index.js
vendored
2
server/dist/index.js
vendored
|
|
@ -15,7 +15,7 @@ import { syncUserData, captureNowPlaying } from './lib/sync.js';
|
||||||
const app = express();
|
const app = express();
|
||||||
app.use(helmet());
|
app.use(helmet());
|
||||||
app.use(cors({ origin: [
|
app.use(cors({ origin: [
|
||||||
'http://localhost:3000',
|
'http://localhost:4000',
|
||||||
'https://159.195.9.107:3443',
|
'https://159.195.9.107:3443',
|
||||||
'http://159.195.9.107:3443'
|
'http://159.195.9.107:3443'
|
||||||
], credentials: true }));
|
], credentials: true }));
|
||||||
|
|
|
||||||
4
server/dist/routes/users.js
vendored
4
server/dist/routes/users.js
vendored
|
|
@ -70,7 +70,7 @@ usersRouter.get('/:uid/now-playing', requireAuth, async (req, res) => {
|
||||||
return res.status(403).json({ error: 'Forbidden' });
|
return res.status(403).json({ error: 'Forbidden' });
|
||||||
if (req.user.uid !== uid) {
|
if (req.user.uid !== uid) {
|
||||||
// allow if users are partnered
|
// allow if users are partnered
|
||||||
const paired = db.db.prepare('SELECT 1 FROM friendships WHERE (user1_id=? AND user2_id=?) OR (user1_id=? AND user2_id=?)').get(req.user.uid, uid, uid, req.user.uid);
|
const paired = db.db.prepare('SELECT 1 FROM friendships WHERE (user_a_id=? AND user_b_id=?) OR (user_a_id=? AND user_b_id=?)').get(req.user.uid, uid, uid, req.user.uid);
|
||||||
if (!paired)
|
if (!paired)
|
||||||
return res.status(403).json({ error: 'Forbidden' });
|
return res.status(403).json({ error: 'Forbidden' });
|
||||||
}
|
}
|
||||||
|
|
@ -108,7 +108,7 @@ usersRouter.get('/:uid/audio-features', requireAuth, async (req, res) => {
|
||||||
if (!req.user)
|
if (!req.user)
|
||||||
return res.status(403).json({ error: 'Forbidden' });
|
return res.status(403).json({ error: 'Forbidden' });
|
||||||
if (req.user.uid !== uid) {
|
if (req.user.uid !== uid) {
|
||||||
const paired = db.db.prepare('SELECT 1 FROM friendships WHERE (user1_id=? AND user2_id=?) OR (user1_id=? AND user2_id=?)').get(req.user.uid, uid, uid, req.user.uid);
|
const paired = db.db.prepare('SELECT 1 FROM friendships WHERE (user_a_id=? AND user_b_id=?) OR (user_a_id=? AND user_b_id=?)').get(req.user.uid, uid, uid, req.user.uid);
|
||||||
if (!paired)
|
if (!paired)
|
||||||
return res.status(403).json({ error: 'Forbidden' });
|
return res.status(403).json({ error: 'Forbidden' });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ const app = express();
|
||||||
|
|
||||||
app.use(helmet());
|
app.use(helmet());
|
||||||
app.use(cors({ origin: [
|
app.use(cors({ origin: [
|
||||||
'http://localhost:3000',
|
'http://localhost:4000',
|
||||||
'https://159.195.9.107:3443',
|
'https://159.195.9.107:3443',
|
||||||
'http://159.195.9.107:3443'
|
'http://159.195.9.107:3443'
|
||||||
], credentials: true }));
|
], credentials: true }));
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ usersRouter.get('/:uid/now-playing', requireAuth, async (req: AuthedRequest, res
|
||||||
if (!req.user) return res.status(403).json({ error: 'Forbidden' });
|
if (!req.user) return res.status(403).json({ error: 'Forbidden' });
|
||||||
if (req.user.uid !== uid) {
|
if (req.user.uid !== uid) {
|
||||||
// allow if users are partnered
|
// allow if users are partnered
|
||||||
const paired = db.db.prepare('SELECT 1 FROM friendships WHERE (user1_id=? AND user2_id=?) OR (user1_id=? AND user2_id=?)').get(req.user.uid, uid, uid, req.user.uid);
|
const paired = db.db.prepare('SELECT 1 FROM friendships WHERE (user_a_id=? AND user_b_id=?) OR (user_a_id=? AND user_b_id=?)').get(req.user.uid, uid, uid, req.user.uid);
|
||||||
if (!paired) return res.status(403).json({ error: 'Forbidden' });
|
if (!paired) return res.status(403).json({ error: 'Forbidden' });
|
||||||
}
|
}
|
||||||
// Try DB-captured snapshot first (last 60s)
|
// Try DB-captured snapshot first (last 60s)
|
||||||
|
|
@ -108,7 +108,7 @@ usersRouter.get('/:uid/audio-features', requireAuth, async (req: AuthedRequest,
|
||||||
const ids = String(req.query.ids || '').split(',').map(s => s.trim()).filter(Boolean);
|
const ids = String(req.query.ids || '').split(',').map(s => s.trim()).filter(Boolean);
|
||||||
if (!req.user) return res.status(403).json({ error: 'Forbidden' });
|
if (!req.user) return res.status(403).json({ error: 'Forbidden' });
|
||||||
if (req.user.uid !== uid) {
|
if (req.user.uid !== uid) {
|
||||||
const paired = db.db.prepare('SELECT 1 FROM friendships WHERE (user1_id=? AND user2_id=?) OR (user1_id=? AND user2_id=?)').get(req.user.uid, uid, uid, req.user.uid);
|
const paired = db.db.prepare('SELECT 1 FROM friendships WHERE (user_a_id=? AND user_b_id=?) OR (user_a_id=? AND user_b_id=?)').get(req.user.uid, uid, uid, req.user.uid);
|
||||||
if (!paired) return res.status(403).json({ error: 'Forbidden' });
|
if (!paired) return res.status(403).json({ error: 'Forbidden' });
|
||||||
}
|
}
|
||||||
if (!ids.length) return res.json({ audio_features: [] });
|
if (!ids.length) return res.json({ audio_features: [] });
|
||||||
|
|
|
||||||
BIN
spotify.db
BIN
spotify.db
Binary file not shown.
BIN
spotify.db-shm
BIN
spotify.db-shm
Binary file not shown.
BIN
spotify.db-wal
BIN
spotify.db-wal
Binary file not shown.
|
|
@ -5,7 +5,7 @@ import react from '@vitejs/plugin-react'
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
server: {
|
server: {
|
||||||
port: 3000,
|
port: 4000,
|
||||||
host: true
|
host: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user