mirror of
https://akkoma.dev/AkkomaGang/akkoma-fe
synced 2025-05-11 15:09:14 +08:00
Obfuscate instance & add SHA256 tooltip
This commit is contained in:
parent
3f65a94be3
commit
d02710d6e2
2 changed files with 20 additions and 3 deletions
|
@ -1,5 +1,17 @@
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import { get } from 'lodash'
|
import { get } from 'lodash'
|
||||||
|
import sha256 from 'crypto-js/sha256'
|
||||||
|
|
||||||
|
/** Haven't checked admin-fe sorry */
|
||||||
|
const OBFUSCATE = true
|
||||||
|
|
||||||
|
const obfuscate = (instance) => {
|
||||||
|
const half = Math.floor(instance.length / 2)
|
||||||
|
const fourth = Math.ceil(half / 2)
|
||||||
|
const slices = instance.match(new RegExp(`(.{${fourth}})(.{${half}})(.*)`))
|
||||||
|
slices[2] = slices[2].replace(/[^.]/g, '*')
|
||||||
|
return slices.slice(1, 4).join('')
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is for backwards compatibility. We originally didn't recieve
|
* This is for backwards compatibility. We originally didn't recieve
|
||||||
|
@ -9,10 +21,12 @@ import { get } from 'lodash'
|
||||||
*/
|
*/
|
||||||
const toInstanceReasonObject = (instances, info, key) => {
|
const toInstanceReasonObject = (instances, info, key) => {
|
||||||
return instances.map(instance => {
|
return instances.map(instance => {
|
||||||
|
const censored = OBFUSCATE ? obfuscate(instance) : instance
|
||||||
|
const crypt = sha256(instance).toString()
|
||||||
if (info[key] && info[key][instance] && info[key][instance]['reason']) {
|
if (info[key] && info[key][instance] && info[key][instance]['reason']) {
|
||||||
return { instance: instance, reason: info[key][instance]['reason'] }
|
return { instance: censored, reason: info[key][instance]['reason'], sha256: crypt }
|
||||||
}
|
}
|
||||||
return { instance: instance, reason: '' }
|
return { instance: censored, reason: '', sha256: crypt }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,10 @@
|
||||||
v-for="entry in rejectInstances"
|
v-for="entry in rejectInstances"
|
||||||
:key="entry.instance + '_reject'"
|
:key="entry.instance + '_reject'"
|
||||||
>
|
>
|
||||||
<td>{{ entry.instance }}</td>
|
<td
|
||||||
|
:title="entry.sha256"
|
||||||
|
:aria-label="entry.sha256"
|
||||||
|
>{{ entry.instance }}</td>
|
||||||
<td v-if="entry.reason === ''">
|
<td v-if="entry.reason === ''">
|
||||||
{{ $t("about.mrf.simple.not_applicable") }}
|
{{ $t("about.mrf.simple.not_applicable") }}
|
||||||
</td>
|
</td>
|
||||||
|
|
Loading…
Reference in a new issue