| 
681 | 681 |                             </div>  | 
682 | 682 | 
 
  | 
683 | 683 |                             <div v-if="monitor.type === 'http' || monitor.type === 'keyword' || monitor.type === 'json-query' " class="my-3 form-check">  | 
684 |  | -                                <input id="domain-expiry-notification" v-model="monitor.domainExpiryNotification" class="form-check-input" type="checkbox">  | 
 | 684 | +                                <input id="domain-expiry-notification" v-model="monitor.domainExpiryNotification" class="form-check-input" type="checkbox" :disabled="!urlIsDomain">  | 
685 | 685 |                                 <label class="form-check-label" for="domain-expiry-notification">  | 
686 | 686 |                                     {{ $t("Domain Name Expiry Notification") }}  | 
687 | 687 |                                 </label>  | 
@@ -1206,6 +1206,7 @@ const monitorDefaults = {  | 
1206 | 1206 |     ignoreTls: false,  | 
1207 | 1207 |     upsideDown: false,  | 
1208 | 1208 |     expiryNotification: false,  | 
 | 1209 | +    domainExpiryNotification: true,  | 
1209 | 1210 |     maxredirects: 10,  | 
1210 | 1211 |     accepted_statuscodes: [ "200-299" ],  | 
1211 | 1212 |     dns_resolve_type: "A",  | 
@@ -1558,6 +1559,20 @@ message HealthCheckResponse {  | 
1558 | 1559 |         conditionVariables() {  | 
1559 | 1560 |             return this.$root.monitorTypeList[this.monitor.type]?.conditionVariables || [];  | 
1560 | 1561 |         },  | 
 | 1562 | +
  | 
 | 1563 | +        urlIsDomain() {  | 
 | 1564 | +            if (!this.monitor.url) {  | 
 | 1565 | +                return false;  | 
 | 1566 | +            }  | 
 | 1567 | +            try {  | 
 | 1568 | +                const url = new URL(this.monitor.url);  | 
 | 1569 | +                const tld = url.hostname.split(".").pop();  | 
 | 1570 | +                // Very simple check : if the tld contains a letter, it is a domain, if not, it is an IP  | 
 | 1571 | +                return /[a-zA-Z]/.test(tld);  | 
 | 1572 | +            } catch {  | 
 | 1573 | +                return false;  | 
 | 1574 | +            }  | 
 | 1575 | +        }  | 
1561 | 1576 |     },  | 
1562 | 1577 |     watch: {  | 
1563 | 1578 |         "$root.proxyList"() {  | 
@@ -1939,6 +1954,10 @@ message HealthCheckResponse {  | 
1939 | 1954 |                 this.monitor.url = this.monitor.url.trim();  | 
1940 | 1955 |             }  | 
1941 | 1956 | 
  | 
 | 1957 | +            if (this.monitor.domainExpiryNotification) {  | 
 | 1958 | +                this.monitor.domainExpiryNotification = this.urlIsDomain;  | 
 | 1959 | +            }  | 
 | 1960 | +
  | 
1942 | 1961 |             let createdNewParent = false;  | 
1943 | 1962 | 
  | 
1944 | 1963 |             if (this.draftGroupName && this.monitor.parent === -1) {  | 
 | 
0 commit comments