Use "blocked" instead of "blacklisted", for consistency with the buttons and terminology in the UI

This commit is contained in:
CalDescent 2021-12-10 11:34:10 +00:00
parent 0464245218
commit e481a5926a
16 changed files with 43 additions and 41 deletions

View File

@ -29,7 +29,7 @@ public class GatewayResource {
/**
* We need to allow resource status checking (and building) via the gateway, as the node's API port
* may not be forwarded and will almost certainly not be authenticated. Since gateways allow for
* all resources to be loaded except those that are blacklisted, there is no need for authentication.
* all resources to be loaded except those that are blocked, there is no need for authentication.
*/
@GET
@Path("/arbitrary/resource/status/{service}/{name}")

View File

@ -14,7 +14,7 @@ public class ArbitraryResourceSummary {
MISSING_DATA,
BUILD_FAILED,
UNSUPPORTED,
BLACKLISTED
BLOCKED
}
public ArbitraryResourceStatus status;

View File

@ -318,9 +318,9 @@ public class ArbitraryDataReader {
arbitraryDataFile.setMetadataHash(metadataHash);
if (!arbitraryDataFile.allFilesExist()) {
if (ArbitraryDataStorageManager.getInstance().isNameInBlacklist(transactionData.getName())) {
if (ArbitraryDataStorageManager.getInstance().isNameBlocked(transactionData.getName())) {
throw new DataException(
String.format("Unable to request missing data for file %s due to blacklist", arbitraryDataFile));
String.format("Unable to request missing data for file %s because the name is blocked", arbitraryDataFile));
}
else {
// Ask the arbitrary data manager to fetch data for this transaction
@ -379,7 +379,7 @@ public class ArbitraryDataReader {
} catch (NoSuchAlgorithmException | InvalidAlgorithmParameterException | NoSuchPaddingException
| BadPaddingException | IllegalBlockSizeException | IOException | InvalidKeyException e) {
// TODO: delete files and blacklist this resource if privateDataEnabled is false
// TODO: delete files and block this resource if privateDataEnabled is false
throw new DataException(String.format("Unable to decrypt file at path %s: %s", this.filePath, e.getMessage()));
}
} else {

View File

@ -41,10 +41,10 @@ public class ArbitraryDataResource {
return new ArbitraryResourceSummary(ArbitraryResourceStatus.UNSUPPORTED);
}
// Check if the name is blacklisted
// Check if the name is blocked
if (ResourceListManager.getInstance()
.listContains("blacklistedNames", this.resourceId, false)) {
return new ArbitraryResourceSummary(ArbitraryResourceStatus.BLACKLISTED);
.listContains("blockedNames", this.resourceId, false)) {
return new ArbitraryResourceSummary(ArbitraryResourceStatus.BLOCKED);
}
// Firstly check the cache to see if it's already built

View File

@ -448,10 +448,10 @@ public class ArbitraryDataCleanupManager extends Thread {
if (directories != null) {
for (final File directory : directories) {
// Delete data relating to blacklisted names
// Delete data relating to blocked names
String name = directory.getName();
if (name != null && storageManager.isNameInBlacklist(name)) {
this.safeDeleteDirectory(directory, "blacklisted name");
if (name != null && storageManager.isNameBlocked(name)) {
this.safeDeleteDirectory(directory, "blocked name");
}
// Delete cached reader data that has reached its expiry

View File

@ -113,13 +113,13 @@ public class ArbitraryDataStorageManager extends Thread {
// Don't check for storage limits here, as it can cause the cleanup manager to delete existing data
// Check if our storage policy and blacklist allows us to host data for this name
// Check if our storage policy and and lists allow us to host data for this name
switch (Settings.getInstance().getStoragePolicy()) {
case FOLLOWED_AND_VIEWED:
case ALL:
case VIEWED:
// If the policy includes viewed data, we can host it as long as it's not blacklisted
return !this.isNameInBlacklist(name);
// If the policy includes viewed data, we can host it as long as it's not blocked
return !this.isNameBlocked(name);
case FOLLOWED:
// If the policy is for followed data only, we have to be following it
@ -166,8 +166,8 @@ public class ArbitraryDataStorageManager extends Thread {
return this.shouldPreFetchDataWithoutName();
}
// Never fetch data from blacklisted names, even if they are followed
if (this.isNameInBlacklist(name)) {
// Never fetch data from blocked names, even if they are followed
if (this.isNameBlocked(name)) {
return false;
}
@ -222,8 +222,8 @@ public class ArbitraryDataStorageManager extends Thread {
return true;
}
public boolean isNameInBlacklist(String name) {
return ResourceListManager.getInstance().listContains("blacklistedNames", name, false);
public boolean isNameBlocked(String name) {
return ResourceListManager.getInstance().listContains("blockedNames", name, false);
}
private boolean isFollowingName(String name) {

View File

@ -28,7 +28,7 @@ public class ResourceList {
* This can be used for local blocking, or even for curating and sharing content lists
* Lists are backed off to JSON files (in the lists folder) to ease sharing between nodes and users
*
* @param name - the name of the list, for instance "addressblacklist"
* @param name - the name of the list, for instance "blockedAddresses"
* @throws IOException
*/
public ResourceList(String name) throws IOException {

View File

@ -145,19 +145,19 @@ public class ChatTransaction extends Transaction {
public ValidationResult isValid() throws DataException {
// Nonce checking is done via isSignatureValid() as that method is only called once per import
// Check for blacklisted author by address
// Check for blocked author by address
ResourceListManager listManager = ResourceListManager.getInstance();
if (listManager.listContains("blacklistedAddresses", this.chatTransactionData.getSender(), true)) {
return ValidationResult.ADDRESS_IN_BLACKLIST;
if (listManager.listContains("blockedAddresses", this.chatTransactionData.getSender(), true)) {
return ValidationResult.ADDRESS_BLOCKED;
}
// Check for blacklisted author by registered name
// Check for blocked author by registered name
List<NameData> names = this.repository.getNameRepository().getNamesByOwner(this.chatTransactionData.getSender());
if (names != null && names.size() > 0) {
for (NameData nameData : names) {
if (nameData != null && nameData.getName() != null) {
if (listManager.listContains("blacklistedNames", nameData.getName(), false)) {
return ValidationResult.NAME_IN_BLACKLIST;
if (listManager.listContains("blockedNames", nameData.getName(), false)) {
return ValidationResult.NAME_BLOCKED;
}
}
}

View File

@ -247,8 +247,8 @@ public abstract class Transaction {
INVALID_GROUP_BLOCK_DELAY(93),
INCORRECT_NONCE(94),
INVALID_TIMESTAMP_SIGNATURE(95),
ADDRESS_IN_BLACKLIST(96),
NAME_IN_BLACKLIST(97),
ADDRESS_BLOCKED(96),
NAME_BLOCKED(97),
INVALID_BUT_OK(999),
NOT_YET_RELEASED(1000);

View File

@ -180,9 +180,9 @@ INCORRECT_NONCE = incorrect PoW nonce
INVALID_TIMESTAMP_SIGNATURE = invalid timestamp signature
ADDRESS_IN_BLACKLIST = this address is in your blacklist
ADDRESS_BLOCKED = this address is blocked
NAME_IN_BLACKLIST = this name is in your blacklist
NAME_BLOCKED = this name is blocked
ADDRESS_ABOVE_RATE_LIMIT = address reached specified rate limit

View File

@ -180,9 +180,9 @@ TRANSACTION_UNKNOWN = tuntematon transaktio
TX_GROUP_ID_MISMATCH = transaktion ryhmä-ID:n vastaavuusvirhe
ADDRESS_IN_BLACKLIST = this address is in your blacklist
ADDRESS_BLOCKED = this address is blocked
NAME_IN_BLACKLIST = this name is in your blacklist
NAME_BLOCKED = this name is blocked
ADDRESS_ABOVE_RATE_LIMIT = address reached specified rate limit

View File

@ -182,9 +182,9 @@ INCORRECT_NONCE = helytelen Proof-of-Work Nonce
INVALID_TIMESTAMP_SIGNATURE = érvénytelen időbélyeg aláírás
ADDRESS_IN_BLACKLIST = ez a fiókcím a fekete listádon van
ADDRESS_BLOCKED = this address is blocked
NAME_IN_BLACKLIST = this name is in your blacklist
NAME_BLOCKED = this name is blocked
ADDRESS_ABOVE_RATE_LIMIT = ez a cím elérte a megengedett mérték korlátot

View File

@ -182,9 +182,9 @@ TRANSACTION_UNKNOWN = transazione sconosciuta
TX_GROUP_ID_MISMATCH = identificazione di gruppo della transazione non corrisponde
ADDRESS_IN_BLACKLIST = this address is in your blacklist
ADDRESS_BLOCKED = this address is blocked
NAME_IN_BLACKLIST = this name is in your blacklist
NAME_BLOCKED = this name is blocked
ADDRESS_ABOVE_RATE_LIMIT = address reached specified rate limit

View File

@ -180,9 +180,9 @@ TRANSACTION_UNKNOWN = transactie onbekend
TX_GROUP_ID_MISMATCH = groep-ID van transactie matcht niet
ADDRESS_IN_BLACKLIST = this address is in your blacklist
ADDRESS_BLOCKED = this address is blocked
NAME_IN_BLACKLIST = this name is in your blacklist
NAME_BLOCKED = this name is blocked
ADDRESS_ABOVE_RATE_LIMIT = address reached specified rate limit

View File

@ -174,7 +174,9 @@ TRANSACTION_UNKNOWN = неизвестная транзакция
TX_GROUP_ID_MISMATCH = не соответствие идентификатора группы c хэш транзации
ADDRESS_IN_BLACKLIST = this address is in your blacklist
ADDRESS_BLOCKED = this address is blocked
NAME_BLOCKED = this name is blocked
ADDRESS_ABOVE_RATE_LIMIT = address reached specified rate limit

View File

@ -62,8 +62,8 @@
textStatus = "Unsupported request";
document.getElementById("status").style.color = "red";
}
else if (json.status == "BLACKLISTED") {
textStatus = name + " is blacklisted so content cannot be served";
else if (json.status == "BLOCKED") {
textStatus = name + " is blocked so content cannot be served";
retryInterval = 5000;
document.getElementById("status").style.color = "red";
}