Skip to content

Commit

Permalink
refactor: enhance security for rendering followed actors list
Browse files Browse the repository at this point in the history
  • Loading branch information
akhileshthite committed Mar 20, 2024
1 parent 9fcefbe commit 5f6bd3f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions followed-accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ class FollowedActorsList extends HTMLElement {

async renderFollowedActors () {
const followedActors = await db.getFollowedActors()
this.innerHTML = followedActors
.map((actor) => {
const formattedDate = this.formatDate(actor.followedAt)
return `<div>- Followed URL: ${actor.url} - Followed At: ${formattedDate}</div>`
})
.join('')
this.innerHTML = ''
followedActors.forEach(actor => {
const actorElement = document.createElement('div')
const formattedDate = this.formatDate(actor.followedAt)

actorElement.innerText = `- Followed URL: ${actor.url} - Followed At: ${formattedDate}`

this.appendChild(actorElement)
})
}

formatDate (dateString) {
Expand Down

0 comments on commit 5f6bd3f

Please sign in to comment.