Generate a public read-only link to share your board🔗

Aperta
#683 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
express, javascript, mongodb, node.js, react, vite

Direzione di ricerca

Start with server/models/User.js and the existing route setup to see how authentication and task queries are handled; then read App.jsx and the client page routing. Implement the public share route and read-only page described in the issue, and add the navbar controls. Done means sharing can be enabled and disabled, the public link shows only the listed task fields, and visitors cannot edit or drag tasks.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement good first issue

Generate a public read-only link to share your board🔗

Files: server/models/User.js + server/routes/share.js (new)
+ client/src/pages/SharedBoard.jsx (new) + App.jsx

Want to show your board to a mentor or recruiter without
making them sign up? Can't right now 💀

// User.js
shareToken: { type: String, default: null }

// routes/share.js
const crypto = require('crypto')

router.post('/enable', protect, async (req, res) => {
const token = crypto.randomBytes(16).toString('hex')
await User.findByIdAndUpdate(req.user._id, { shareToken: token })
res.json({ url: ${process.env.FRONTEND_URL}/share/${token} })
})

router.delete('/disable', protect, async (req, res) => {
await User.findByIdAndUpdate(req.user._id, { shareToken: null })
res.json({ message: 'Sharing disabled' })
})

// public, no auth middleware:
router.get('/:token', async (req, res) => {
const user = await User.findOne({ shareToken: req.params.token })
if (!user) return res.status(404).json({ message: 'Not found' })
const tasks = await Task.find({ assignee: user._id })
.select('title status priority tags createdAt')
res.json({ owner: user.name, tasks })
})

Note: .select() leaves out description, snippets and notes on
purpose, so nothing private leaks.

Client: new /share/:token route rendering the board with no
drag-drop and no edit buttons. Add "Enable / Disable sharing"
in the navbar.

~50 lines across 4 files 🎯

Lingua principale
JavaScript
Stelle
39
Fork
105
Merge medio
2g 10h
PR unite (30g)
22

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di anoopcodehack/DevBoard

Tutte le issue di anoopcodehack/DevBoard

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.