mirror of
https://github.com/rekryt/iplist.git
synced 2026-02-26 01:08:31 +03:00
feat: template for MikrotikController
https://github.com/rekryt/iplist/issues/88
This commit is contained in:
@@ -279,6 +279,12 @@ iplist_v4_cidr
|
||||
- In IP -> Firewall -> Address Lists, a new lists should appear (in this example, named `youtube`)
|
||||
- 
|
||||
|
||||
Using the `template` GET parameter for the `mikrotik` format, you can specify a template for the list name:
|
||||
```
|
||||
https://iplist.opencck.org/?format=mikrotik&data=cidr4&append=timeout%3D1d&template={group}_{data}
|
||||
```
|
||||
By default the template has the value: `{group}_{data}`
|
||||
|
||||
## Setting up HomeProxy (sing-box)
|
||||
Enable "Routing mode" in "Only proxy mainland China":
|
||||

|
||||
|
||||
@@ -287,6 +287,12 @@ iplist_v4_cidr
|
||||
- А в разделе IP -> Firewall -> Address Lists должны появиться новые списоки (в примере с именем `youtube`)
|
||||
- 
|
||||
|
||||
Через GET-параметр `template` для формата `mikrotik` можно указывать шаблон для имени списка:
|
||||
```
|
||||
https://iplist.opencck.org/?format=mikrotik&data=cidr4&append=timeout%3D1d&template={group}_{data}
|
||||
```
|
||||
По умолчанию шаблон имеет значение: `{group}_{data}`
|
||||
|
||||
## Настройка HomeProxy (sing-box)
|
||||
Включите "Routing mode" в "Only proxy mainland China":
|
||||

|
||||
|
||||
@@ -15,6 +15,7 @@ class MikrotikController extends AbstractIPListController {
|
||||
$sites = SiteFactory::normalizeArray($this->request->getQueryParameters()['site'] ?? []);
|
||||
$data = $this->request->getQueryParameter('data') ?? '';
|
||||
$append = $this->request->getQueryParameter('append') ?? '';
|
||||
$template = $this->request->getQueryParameter('template') ?? '{group}_{data}';
|
||||
if ($data == '') {
|
||||
return "# Error: The 'data' GET parameter is required in the URL to access this page";
|
||||
}
|
||||
@@ -28,7 +29,17 @@ class MikrotikController extends AbstractIPListController {
|
||||
continue;
|
||||
}
|
||||
|
||||
$listName = $groupName . '_' . $data;
|
||||
foreach (
|
||||
[
|
||||
'group' => $groupName,
|
||||
'data' => $data,
|
||||
]
|
||||
as $key => $value
|
||||
) {
|
||||
$template = str_replace('{' . $key . '}', $value, $template);
|
||||
}
|
||||
|
||||
$listName = $template;
|
||||
$response = array_merge($response, [
|
||||
'/ip firewall address-list remove [find list="' . $listName . '"];',
|
||||
':delay 5s',
|
||||
|
||||
Reference in New Issue
Block a user