Przeglądaj źródła

cannot use underscores in view/action/field names, causes problems with error setter

tags/v0.5.0
Jonathan Cobb 4 lat temu
rodzic
commit
d659b4c123
4 zmienionych plików z 54 dodań i 56 usunięć
  1. +20
    -16
      bubble-server/src/main/java/bubble/app/bblock/BubbleBlockAppConfigDriver.java
  2. +1
    -0
      bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties
  3. +32
    -39
      bubble-server/src/main/resources/models/apps/bubble_block/bubbleApp_bubbleBlock.json
  4. +1
    -1
      bubble-web

+ 20
- 16
bubble-server/src/main/java/bubble/app/bblock/BubbleBlockAppConfigDriver.java Wyświetl plik

@@ -28,8 +28,8 @@ import static org.cobbzilla.wizard.resources.ResourceUtil.notFoundEx;

public class BubbleBlockAppConfigDriver implements AppConfigDriver {

public static final String VIEW_manage_lists = "manage_lists";
public static final String VIEW_manage_list = "manage_list";
public static final String VIEW_manageLists = "manageLists";
public static final String VIEW_manageList = "manageList";
public static final String VIEW_manage_entries = "manage_entries";

@Autowired private RuleDriverDAO driverDAO;
@@ -38,10 +38,10 @@ public class BubbleBlockAppConfigDriver implements AppConfigDriver {
@Override public Object getView(Account account, BubbleApp app, String view, Map<String, String> params) {
final String id = params.get(PARAM_ID);
switch (view) {
case VIEW_manage_lists:
case VIEW_manageLists:
return loadAllLists(account, app);

case VIEW_manage_list:
case VIEW_manageList:
if (empty(id)) throw notFoundEx(id);
return loadList(account, app, id);

@@ -89,14 +89,14 @@ public class BubbleBlockAppConfigDriver implements AppConfigDriver {
return rules.get(0);
}

public static final String ACTION_enable_list = "enable_list";
public static final String ACTION_disable_list = "disable_list";
public static final String ACTION_create_list = "create_list";
public static final String ACTION_remove_list = "remove_list";
public static final String ACTION_manage_list = "manage_list";
public static final String ACTION_manage_list_rules = "manage_list_rules";
public static final String ACTION_create_rule = "create_rule";
public static final String ACTION_remove_rule = "remove_rule";
public static final String ACTION_enableList = "enableList";
public static final String ACTION_disableList = "disableList";
public static final String ACTION_createList = "createList";
public static final String ACTION_removeList = "removeList";
public static final String ACTION_manageList = "manageList";
public static final String ACTION_manageListRules = "manageListRules";
public static final String ACTION_createRule = "createRule";
public static final String ACTION_removeRule = "removeRule";
public static final String ACTION_test_url = "test_url";

public static final String PARAM_URL = "url";
@@ -108,7 +108,7 @@ public class BubbleBlockAppConfigDriver implements AppConfigDriver {
Map<String, String> params,
JsonNode data) {
switch (action) {
case ACTION_create_list:
case ACTION_createList:
return addList(account, app, data);
}
throw notFoundEx(action);
@@ -176,19 +176,23 @@ public class BubbleBlockAppConfigDriver implements AppConfigDriver {
BubbleBlockList list;

switch (action) {
case ACTION_enable_list:
case ACTION_enableList:
list = loadList(account, app, id);
if (list == null) throw notFoundEx(id);
return updateList(list.setEnabled(true));

case ACTION_disable_list:
case ACTION_disableList:
list = loadList(account, app, id);
if (list == null) throw notFoundEx(id);
return updateList(list.setEnabled(false));

case ACTION_remove_list:
case ACTION_removeList:
list = loadList(account, app, id);
if (list == null) throw notFoundEx(id);
if (empty(list.getUrl())) {
// only one empty-URL list is allowed (the custom bubble list) and it cannot be removed
throw invalidEx("err.removeList.cannotRemoveBuiltinList");
}
return removeList(list);
}



+ 1
- 0
bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties Wyświetl plik

@@ -583,6 +583,7 @@ err.refund.unpaidBillHasPayment=Unpaid bill shows payment, not issuing refund. P
err.refund.unknownError=An error occurred processing your refund. Please contact support
err.remoteHost.length=Remote host is too long
err.remoteHost.required=Remote host is required
err.removeList.cannotRemoveBuiltinList=Cannot remove the built-in filter list
err.request.invalid=Request is invalid
err.restoreKey.invalid=Restore key is invalid
err.restoreKey.required=Restore key is required


+ 32
- 39
bubble-server/src/main/resources/models/apps/bubble_block/bubbleApp_bubbleBlock.json Wyświetl plik

@@ -33,42 +33,42 @@
{"name": "rule"}
],
"configViews": [{
"name": "manage_lists",
"name": "manageLists",
"scope": "app",
"root": "true",
"fields": ["name", "description", "url", "enabled", "tagString"],
"actions": [
{"name": "enable_list", "when": "!item.enabled"},
{"name": "disable_list", "when": "item.enabled"},
{"name": "manage_list", "view": "manage_list"},
{"name": "remove_list"},
{"name": "enableList", "when": "!item.enabled"},
{"name": "disableList", "when": "item.enabled"},
{"name": "manageList", "view": "manageList"},
{"name": "removeList"},
{
"name": "create_list", "scope": "app", "view": "manage_list",
"name": "createList", "scope": "app", "view": "manageList",
"params": [{"name": "url", "type": "http_url"}],
"button": "create_list"
"button": "createList"
}
]
}, {
"name": "manage_list",
"name": "manageList",
"scope": "item",
"fields": ["name", "description", "url", "tags", "enabled"],
"actions": [
{"name": "enable_list", "when": "!item.enabled"},
{"name": "disable_list", "when": "item.enabled"},
{"name": "remove_list"},
{"name": "update_list"},
{"name": "manage_list_rules"}
{"name": "enableList", "when": "!item.enabled"},
{"name": "disableList", "when": "item.enabled"},
{"name": "removeList"},
{"name": "updateList"},
{"name": "manageListRules"}
]
}, {
"name": "manage_rules",
"name": "manageRules",
"scope": "item",
"fields": ["rule"],
"actions": [
{"name": "remove_rule"},
{"name": "removeRule"},
{
"name": "create_rule",
"name": "createRule",
"params": [{"name": "url", "type": "http_url"}],
"button": "create_rule"
"button": "createRule"
},
{
"name": "test_url",
@@ -133,9 +133,9 @@
{"name": "view.last_30_days", "value": "Last 30 Days"},
{"name": "view.last_30_days.ctime.format", "value": "{{MM}} {{d}}, {{YYYY}}"},

{"name": "config.view.manage_lists", "value": "Manage Filter Lists"},
{"name": "config.view.manage_list", "value": "Manage Filter List"},
{"name": "config.view.manage_rules", "value": "Manage Filter Rules"},
{"name": "config.view.manageLists", "value": "Manage Filter Lists"},
{"name": "config.view.manageList", "value": "Manage Filter List"},
{"name": "config.view.manageRules", "value": "Manage Filter Rules"},

{"name": "config.field.name", "value": "Name"},
{"name": "config.field.description", "value": "Description"},
@@ -147,26 +147,19 @@
{"name": "config.field.enabled", "value": "Enabled"},
{"name": "config.field.rule", "value": "Rule"},

{"name": "config.action.enable_list", "value": "Enable"},
{"name": "config.action.disable_list", "value": "Disable"},
{"name": "config.action.manage_list", "value": "Manage List"},
{"name": "config.action.remove_list", "value": "Remove List"},
{"name": "config.action.create_list", "value": "Add New List"},
{"name": "config.button.create_list", "value": "Add"},
{"name": "config.action.update_list", "value": "Update List"},
{"name": "config.action.manage_list_rules", "value": "Manage Rules"},
{"name": "config.action.remove_rule", "value": "Remove Rule"},
{"name": "config.action.create_rule", "value": "Add New Rule"},
{"name": "config.button.create_rule", "value": "Add"},
{"name": "config.action.enableList", "value": "Enable"},
{"name": "config.action.disableList", "value": "Disable"},
{"name": "config.action.manageList", "value": "Manage List"},
{"name": "config.action.removeList", "value": "Remove List"},
{"name": "config.action.createList", "value": "Add New List"},
{"name": "config.button.createList", "value": "Add"},
{"name": "config.action.updateList", "value": "Update List"},
{"name": "config.action.manageListRules", "value": "Manage Rules"},
{"name": "config.action.removeRule", "value": "Remove Rule"},
{"name": "config.action.createRule", "value": "Add New Rule"},
{"name": "config.button.createRule", "value": "Add"},
{"name": "config.action.test_url", "value": "Test URL"},
{"name": "config.button.test_url", "value": "Test"},

{"name": "config.item.easylist.name", "value": "EasyList"},
{"name": "config.item.easylist.description", "value": "EasyList is the primary filter list that removes most adverts from international web pages, including unwanted frames, images, and objects. It is the most popular list used by many ad blockers and forms the basis of over a dozen combination and supplementary filter lists."},
{"name": "config.item.local.name", "value": "Bubble Custom List"},
{"name": "config.item.local.description", "value": "A place to maintain your own block rules for this Bubble."},
{"name": "config.item.dandelion_sprouts_anti_malware_list.name", "value": "Dandelion Sprout's Anti-Malware List"},
{"name": "config.item.dandelion_sprouts_anti_malware_list.description", "value": "Most anti-malware lists are pretty big and can cover a 5- or 6-digit amount of specific domains. But my list hereby claims to remove more than 25% of all known malware sites with just a 2-digit amount of entries. This is mostly done by blocking top-level domains that have become devastatingly abused by spammers, usually because they allowed for free and uncontrolled domain registrations. There's also additional categories that cover unusual malware and phishing domains that very few other lists seem to cover."}
{"name": "config.button.test_url", "value": "Test"}
]
}]
}

+ 1
- 1
bubble-web

@@ -1 +1 @@
Subproject commit ff3bd7b442d81c218c4db0c637d9e0bf9c80e9df
Subproject commit 3244ea3346f1ab804d9f8cfcca045dbfbc93f575

Ładowanie…
Anuluj
Zapisz