Skip to content

Commit a6e5131

Browse files
committed
�[200~docs: update command documentation and changelog
1 parent 000ab0a commit a6e5131

File tree

3 files changed

+86
-20
lines changed

3 files changed

+86
-20
lines changed

CHANGELOG.md

+21
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,22 @@ All notable changes to the npm-api.sh script will be documented in this file.
2323
- `--list-cert`: List certificates filtered by domain name
2424
- `--list-cert-all`: List all SSL certificates
2525

26+
### New Long Options Format
27+
28+
- Certificate Generation:
29+
```diff
30+
- OLD: ./npm-api.sh --cert-generate example.com admin@example.com
31+
+ NEW: ./npm-api.sh --cert-generate example.com --cert-email admin@example.com
32+
```
33+
34+
- Wildcard Certificate with DNS Challenge:
35+
```diff
36+
- OLD: ./npm-api.sh --cert-generate "*.example.com" admin@example.com --dns-provider cloudflare --dns-credentials '{"dns_cloudflare_email":"your@email.com","dns_cloudflare_api_key":"your_api_key"}'
37+
+ NEW: ./npm-api.sh --cert-generate "*.example.com" \
38+
+ --cert-email admin@example.com \
39+
+ --dns-provider cloudflare \
40+
+ --dns-credentials '{"dns_cloudflare_email":"your@email.com","dns_cloudflare_api_key":"your_api_key"}'
41+
```
2642

2743
### Renamed Commands
2844

@@ -142,6 +158,11 @@ All notable changes to the npm-api.sh script will be documented in this file.
142158
- Optimized API requests
143159
- Enhanced HTTP error handling
144160

161+
### 🙏 Remerciements
162+
163+
Thanks to [zafar-2020](https://github.com/zafar-2020) for the testing and helpful issue reports during the development of this release!
164+
165+
145166
## [2.7.0] - 2025-03-08
146167

147168
### Added

README.md

+49-15
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ API_PASS="changeme"
149149
-c CACHING_ENABLED Enable caching (true/false, default: false)
150150
-b BLOCK_EXPLOITS Block exploits (true/false, default: true)
151151
-w ALLOW_WEBSOCKET_UPGRADE Allow WebSocket upgrade (true/false, default: true)
152+
-h HTTP2_SUPPORT Enable HTTP/2 support (true/false, default: true)
152153
-l CUSTOM_LOCATIONS Custom locations (JSON array of location objects)
153154
-a ADVANCED_CONFIG Advanced configuration (block of configuration settings)
154155
-y Automatic yes prompts, yes sir!
@@ -174,11 +175,14 @@ API_PASS="changeme"
174175
--host-ssl-enable id Enable SSL, HTTP/2, and HSTS for a proxy host
175176
--host-ssl-disable id Disable SSL, HTTP/2, and HSTS for a proxy host
176177
--list-ssl-cert List All SSL certificates availables (JSON)
177-
--cert-generate domain email Generate certificate for the given domain and email
178-
--delete-cert domain Delete certificate for the given domain
178+
--cert-generate domain [email] [dns_provider] [dns_credentials] [-y] Generate certificate for the given domain and email
179+
--delete-cert domain Delete certificate for the given domain
179180
--list-access List all available access lists (ID and name)
180181
--host-acl-enable id,access_list_id Enable ACL for a proxy host by ID with an access list ID
181182
--host-acl-disable id Disable ACL for a proxy host by ID
183+
--access-list-create Create a new access list with name and rules
184+
--access-list-update id Update an existing access list by ID
185+
--access-list-delete id Delete an access list by ID (requires confirmation unless -y is used)
182186
--update-host id field=value Modify any field on existing entry host
183187
--help Display this help
184188
@@ -192,17 +196,21 @@ API_PASS="changeme"
192196

193197
🌐 Host Creation:
194198
# Basic host creation
195-
./npm-api.sh --host-create example.com -i 192.168.1.10 -p 8080
199+
./npm-api.sh --host-create domain.com -i IP -p PORT [-b true/false] [-c true/false] [-w true/false] [-h true/false]
196200

197201
# Create host with SSL certificate and enable SSL (all-in-one)
198-
./npm-api.sh --host-create sub.domain.com -i 192.168.0.1 -p 80 --cert-generate --host-ssl-enable -y
202+
./npm-api.sh --host-create domain.com -i IP -p PORT [options] --cert-generate --host-ssl-enable -y
203+
204+
# Create host with SSL certificate and enable SSL (with specific domain)
205+
./npm-api.sh --host-create domain.com -i IP -p PORT [options] --cert-generate domain.com --host-ssl-enable -y
199206

200207
# Create host with custom options
201208
./npm-api.sh --host-create example.com -i 192.168.1.10 -p 8080 \
202209
-f https \ # Forward scheme
203210
-b true \ # Block exploits
204211
-c true \ # Enable caching
205212
-w true \ # Enable websocket
213+
-h true \ # Enable HTTP/2
206214
-y # Auto confirm
207215

208216
🤖 Automatic operations (no prompts):
@@ -222,10 +230,8 @@ API_PASS="changeme"
222230
🔒 SSL Management:
223231
# List all certificates
224232
./npm-api.sh --list-ssl-cert
225-
226233
# Generate standard Let's Encrypt certificate
227-
./npm-api.sh --cert-generate example.com --cert-email admin@example.com
228-
234+
./npm-api.sh --cert-generate domain.com [email] [dns_provider] [dns_credentials] [-y]
229235
# Generate wildcard certificate with Cloudflare
230236
./npm-api.sh --cert-generate "*.example.com" \
231237
--cert-email admin@example.com \
@@ -234,12 +240,10 @@ API_PASS="changeme"
234240

235241
# Delete certificate
236242
./npm-api.sh --delete-cert domain.com
237-
238243
# Enable SSL for host
239-
./npm-api.sh --host-ssl-enable 42
240-
241-
# Enable SSL with specific cert ID
242-
./npm-api.sh --host-ssl-enable 42 33
244+
./npm-api.sh --host-ssl-enable HOST_ID
245+
# Generate certificate and enable SSL for existing host
246+
./npm-api.sh --cert-generate domain.com --host-ssl-enable -y
243247

244248
🌟 Complete Examples with Wildcard Certificates:
245249
# Create host with wildcard certificate using Cloudflare DNS
@@ -267,9 +271,36 @@ API_PASS="changeme"
267271
--host-ssl-enable -y
268272

269273
🛡️ Access Control Lists:
270-
./npm-api.sh --list-access # List all access lists
271-
./npm-api.sh --host-acl-enable 42,5 # Enable ACL ID 5 for host 42
272-
./npm-api.sh --host-acl-disable 42 # Disable ACL for host 42
274+
# List all access lists
275+
./npm-api.sh --list-access
276+
# Show detailed information for specific access list
277+
./npm-api.sh --access-list-show 123
278+
# Create a basic access list
279+
./npm-api.sh --access-list-create "office" --satisfy any
280+
# Create access list with authentication
281+
./npm-api.sh --access-list-create "secure_area" --satisfy all --pass-auth true
282+
# Create access list with users
283+
./npm-api.sh --access-list-create "dev_team" --users "john,jane,bob" --pass-auth true
284+
# Create access list with IP rules
285+
./npm-api.sh --access-list-create "internal" --allow "192.168.1.0/24" --deny "192.168.1.100"
286+
# Create comprehensive access list
287+
./npm-api.sh --access-list-create "full_config" \
288+
--satisfy all \
289+
--pass-auth true \
290+
--users "admin1,admin2" \
291+
--allow "10.0.0.0/8,172.16.0.0/12" \
292+
--deny "10.0.0.50,172.16.1.100"
293+
294+
# Update an existing access list
295+
./npm-api.sh --access-list-update 42
296+
# Delete an access list (with confirmation)
297+
./npm-api.sh --access-list-delete 42
298+
# Delete an access list (skip confirmation)
299+
./npm-api.sh --access-list-delete 42 -y
300+
# Enable ACL for a host
301+
./npm-api.sh --host-acl-enable 42,5 # Enable ACL ID 5 for host 42
302+
# Disable ACL for a host
303+
./npm-api.sh --host-acl-disable 42 # Disable ACL for host 42
273304

274305
👥 User Management:
275306
./npm-api.sh --create-user newuser password123 user@example.com
@@ -560,8 +591,11 @@ If you have local changes that you **don't want to lose**, consider making a bac
560591
## Credits & Thanks
561592

562593
Special thanks to:
594+
563595
- [@ichbinder](https://github.com/ichbinder) for implementing the `-y` parameter for automatic confirmations
564596

597+
- 🙏 **Special thanks to [zafar-2020](https://github.com/zafar-2020)** for his valuable help with testing and reporting issues during the development of version 3.0.0!
598+
565599
## License
566600

567601
MIT License - see the [LICENSE.md][license] file for details

npm-api.sh

+16-5
Original file line numberDiff line numberDiff line change
@@ -602,18 +602,29 @@ show_help() {
602602
echo -e "${COLOR_YELLOW}Wildcard domains:${CoR} *.example.com (requires DNS challenge)${CoR}"
603603
echo -e " • DNS Challenge:${CoR} Required for wildcard certificates"
604604
echo -e " - ${COLOR_YELLOW}Format:${CoR} dns-provider PROVIDER dns-api-key KEY"
605-
echo -e " - ${COLOR_YELLOW}Providers:${CoR} dynu, cloudflare, digitalocean, godaddy, namecheap, route53, ovh, gcloud"
605+
echo -e " - ${COLOR_YELLOW}Providers:${CoR} dynu, cloudflare, digitalocean, godaddy, namecheap, route53, ovh, gcloud, ..."
606606
echo ""
607607
echo -e " --user-list List All Users"
608608
echo -e " --user-create ${COLOR_CYAN}username${CoR} ${COLOR_CYAN}password${CoR} ${COLOR_CYAN}email${CoR} Create User with a ${COLOR_YELLOW}username${CoR}, ${COLOR_YELLOW}password${CoR} and ${COLOR_YELLOW}email${CoR}"
609609
echo -e " --user-delete ${COLOR_CYAN}🆔${CoR} Delete User by ${COLOR_YELLOW}username${CoR}"
610610
echo ""
611611
echo -e " --access-list List All available Access Lists (ID and Name)"
612612
echo -e " --access-list-show ${COLOR_CYAN}🆔${CoR} Show detailed information for specific access list"
613-
echo -e " --access-list-create Create Access Lists"
614-
echo -e " --access-list-delete Delete Access Lists"
615-
echo -e " --access-list-update Update Access Lists"
616-
echo -e "\n ${COLOR_CYAN}🆔${CoR} = ID Host Proxy"
613+
echo -e " --access-list-create Create Access Lists with options:"
614+
echo -e "${COLOR_YELLOW}--satisfy [any|all]${CoR} Set access list satisfaction mode"
615+
echo -e "${COLOR_YELLOW}--pass-auth [true|false]${CoR} Enable/disable password authentication"
616+
echo -e "${COLOR_YELLOW}--users \"user1,user2\"${CoR} List of users (comma-separated)"
617+
echo -e "${COLOR_YELLOW}--allow \"ip1,ip2\"${CoR} List of allowed IPs/ranges"
618+
echo -e "${COLOR_YELLOW}--deny \"ip1,ip2\"${CoR} List of denied IPs/ranges"
619+
echo -e " --access-list-delete ${COLOR_CYAN}🆔${CoR} Delete Access List by access ID"
620+
echo -e " --access-list-update ${COLOR_CYAN}🆔${CoR} Update Access List by access ID with options:"
621+
echo -e "${COLOR_YELLOW}--name \"new_name\"${CoR} New name for the access list"
622+
echo -e "${COLOR_YELLOW}--satisfy [any|all]${CoR} Update satisfaction mode"
623+
echo -e "${COLOR_YELLOW}--pass-auth [true|false]${CoR} Update password authentication"
624+
echo -e "${COLOR_YELLOW}--users \"user1,user2\"${CoR} Update list of users"
625+
echo -e "${COLOR_YELLOW}--allow \"ip1,ip2\"${CoR} Update allowed IPs/ranges"
626+
echo -e "${COLOR_YELLOW}--deny \"ip1,ip2\"${CoR} Update denied IPs/ranges\n"
627+
#echo -e "\n ${COLOR_CYAN}🆔${CoR} = ID Host Proxy"
617628
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
618629
echo -e " --examples ${COLOR_ORANGE}🔖 ${CoR}Examples ${COLOR_GREY}commands, more explicits${CoR}"
619630
echo -e " --help ${COLOR_YELLOW}👉 ${COLOR_GREY}It's me${CoR}"

0 commit comments

Comments
 (0)