wafrn instance bluesky labeler (mirror of https://git.jbc.lol/jbcrn/wadge)

fix duplicated labels

Changed files
+20 -18
+20 -18
index.js
··· 153 153 154 154 try { 155 155 const extLabels = await getLabelerLabelDefinitions(credentials); 156 - const labels = [ 157 - ...(extLabels ?? []), 158 - { 159 - identifier: ifWafrn.instHost?.toLowerCase().replaceAll('.', '-'), 160 - name: ifWafrn.instHost, 161 - description: `This user is on ${ifWafrn.instHost} Wafrn instance`, 162 - adultOnly: false, 163 - severity: 'inform', 164 - blurs: "none", 165 - defaultSetting: "warn", 166 - locales: [{ lang: "en", name: ifWafrn.instHost, description: `Main account of this Bluesky user is on ${ifWafrn.instHost} Wafrn instance` }] 167 - } 168 - ] 156 + if (!extLabels.find(x => x.identifier === ifWafrn.instHost?.toLowerCase().replaceAll('.', '-'))) { 157 + const labels = [ 158 + ...(extLabels ?? []), 159 + { 160 + identifier: ifWafrn.instHost?.toLowerCase().replaceAll('.', '-'), 161 + name: ifWafrn.instHost, 162 + description: `Main account of this Bluesky user is on ${ifWafrn.instHost} Wafrn instance`, 163 + adultOnly: false, 164 + severity: 'inform', 165 + blurs: "none", 166 + defaultSetting: "warn", 167 + locales: [{ lang: "en", name: ifWafrn.instHost, description: `Main account of this Bluesky user is on ${ifWafrn.instHost} Wafrn instance` }] 168 + } 169 + ] 169 170 170 - await declareLabeler( 171 - credentials, 172 - labels.filter(onlyUnique), 173 - true 174 - ) 171 + await declareLabeler( 172 + credentials, 173 + labels.filter(onlyUnique), 174 + true 175 + ) 176 + } 175 177 176 178 let label = await server.createLabel({ 177 179 uri: bskyDid,