forked from apxtri/apxtri
checjson fix regex telephonefr
This commit is contained in:
parent
a8dc3ca17b
commit
4b7cf11712
35
README.md
35
README.md
@ -71,6 +71,25 @@ To start you need to
|
|||||||
|
|
||||||
As a mayor, you have to understand what you are doing, your numeric reputation is in the game. Always check sources before downloading any things. For dev use town name: **dev** and nation name :**ants**
|
As a mayor, you have to understand what you are doing, your numeric reputation is in the game. Always check sources before downloading any things. For dev use town name: **dev** and nation name :**ants**
|
||||||
|
|
||||||
|
**Machine:**
|
||||||
|
|
||||||
|
**use a sudoer user and execute command line $, for security reason, do not use apxuser replace it by something not common ( not as admin, mayor,… use your nickname or pseudo)**
|
||||||
|
|
||||||
|
```plaintext
|
||||||
|
$ sudo apt update
|
||||||
|
$ sudo apt upgrade
|
||||||
|
$ sudo useradd -s /bin/bash -m -d /home/{apxuser} -c "{apxuser}" {apxuser}
|
||||||
|
$ sudo passwd {apxuser}
|
||||||
|
$ sudo usermod -aG sudo {apxuser}
|
||||||
|
$ sudo visudo
|
||||||
|
# add the next line in the file
|
||||||
|
$ {apxuser} ALL=(ALL) NOPASSWD: ALL
|
||||||
|
# exit and save
|
||||||
|
$ su {apxuser}
|
||||||
|
```
|
||||||
|
|
||||||
|
For Production
|
||||||
|
|
||||||
### Network:
|
### Network:
|
||||||
|
|
||||||
FOR DEV: you can just use local http:/dev-ants
|
FOR DEV: you can just use local http:/dev-ants
|
||||||
@ -88,7 +107,7 @@ You need a domain name, to get a free one [http://ydns.io](http://ydns.io) creat
|
|||||||
# Into your production machine
|
# Into your production machine
|
||||||
$ crontab -e
|
$ crontab -e
|
||||||
# add a line at the end to update your IP in case you have a dynamic WAN IP
|
# add a line at the end to update your IP in case you have a dynamic WAN IP
|
||||||
1,6,11,16,21,26,31,36,41,46,51,56 * * * * sleep 38 ; wget --no-check-certificate -O - https://ydns.io/hosts/update/Tl7FDQAETmQre312edztgsIUy >> /tmp/apxtri_ydns.io.log 2>&1 &
|
1,6,11,16,21,26,31,36,41,46,51,56 * * * * sleep 38 ; wget --no-check-certificate -O - https://ydns.io/hosts/update/Tl7FDQAETmQre312edztgsIUy >> /tmp/apxtri_ydns.io.log 2>&1
|
||||||
$ ip -4 address # to get your (local) LAN IP of your server
|
$ ip -4 address # to get your (local) LAN IP of your server
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -98,19 +117,7 @@ This allow public access from internet to your DMZ local server. Think to use
|
|||||||
|
|
||||||
### Machine:
|
### Machine:
|
||||||
|
|
||||||
use a sudoer user and execute command line $, for security reason, do not use apxuser replace it by something not common ( not as admin, mayor,… use your nickname or pseudo)
|
|
||||||
|
|
||||||
```plaintext
|
```plaintext
|
||||||
$ sudo apt update
|
|
||||||
$ sudo apt upgrade
|
|
||||||
$ useradd -s /bin/bash -m -d /home/{apxuser} -c "{apxuser}" {apxuser}
|
|
||||||
$ passwd {apxuser}
|
|
||||||
$ sudo usermod -aG sudo {apxuser}
|
|
||||||
$ sudo visudo
|
|
||||||
# add the next line in the file
|
|
||||||
$ {apxuser} ALL=(ALL) NOPASSWD: ALL
|
|
||||||
# exit and save
|
|
||||||
$ su {apxuser}
|
|
||||||
$ sudo apt install git vim libcap2-bin p7zip-full p7zip-rar curl nginx
|
$ sudo apt install git vim libcap2-bin p7zip-full p7zip-rar curl nginx
|
||||||
# Install last nvm** (check website to get latest v0.xx from https://github.com/nvm-sh/nvm)
|
# Install last nvm** (check website to get latest v0.xx from https://github.com/nvm-sh/nvm)
|
||||||
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
|
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
|
||||||
@ -126,7 +133,7 @@ $ yarn --version
|
|||||||
# Find a non existing town to join to an existing nation see https://apxtri.crabedance.com
|
# Find a non existing town to join to an existing nation see https://apxtri.crabedance.com
|
||||||
$ mkdir ~/apxtowns # if it does not exist
|
$ mkdir ~/apxtowns # if it does not exist
|
||||||
$ mkdir ~/apxtowns/{town}-{nation}
|
$ mkdir ~/apxtowns/{town}-{nation}
|
||||||
|
$ sudo chown {apxuser}:root /etc/nginx/nginx.conf
|
||||||
#################################
|
#################################
|
||||||
# For dev #######################
|
# For dev #######################
|
||||||
#################################
|
#################################
|
||||||
|
@ -100,7 +100,7 @@ Checkjson.schema.properties.format = {
|
|||||||
"idn-hostname": / /,
|
"idn-hostname": / /,
|
||||||
ipv4: /^([0–9]{1,3}.){3}.([0–9]{1,3})$/,
|
ipv4: /^([0–9]{1,3}.){3}.([0–9]{1,3})$/,
|
||||||
ipv6: /^((([0–9A-Fa-f]{1,4}:){7}[0–9A-Fa-f]{1,4})|(([0–9A-Fa-f]{1,4}:){6}:[0–9A-Fa-f]{1,4})|(([0–9A-Fa-f]{1,4}:){5}:([0–9A-Fa-f]{1,4}:)?[0–9A-Fa-f]{1,4})|(([0–9A-Fa-f]{1,4}:){4}:([0–9A-Fa-f]{1,4}:){0,2}[0–9A-Fa-f]{1,4})|(([0–9A-Fa-f]{1,4}:){3}:([0–9A-Fa-f]{1,4}:){0,3}[0–9A-Fa-f]{1,4})|(([0–9A-Fa-f]{1,4}:){2}:([0–9A-Fa-f]{1,4}:){0,4}[0–9A-Fa-f]{1,4})|(([0–9A-Fa-f]{1,4}:){6}((b((25[0–5])|(1d{2})|(2[0–4]d)|(d{1,2}))b).){3}(b((25[0–5])|(1d{2})|(2[0–4]d)|(d{1,2}))b))|(([0–9A-Fa-f]{1,4}:){0,5}:((b((25[0–5])|(1d{2})|(2[0–4]d)|(d{1,2}))b).){3}(b((25[0–5])|(1d{2})|(2[0–4]d)|(d{1,2}))b))|(::([0–9A-Fa-f]{1,4}:){0,5}((b((25[0–5])|(1d{2})|(2[0–4]d)|(d{1,2}))b).){3}(b((25[0–5])|(1d{2})|(2[0–4]d)|(d{1,2}))b))|([0–9A-Fa-f]{1,4}::([0–9A-Fa-f]{1,4}:){0,5}[0–9A-Fa-f]{1,4})|(::([0–9A-Fa-f]{1,4}:){0,6}[0–9A-Fa-f]{1,4})|(([0–9A-Fa-f]{1,4}:){1,7}:))$/,
|
ipv6: /^((([0–9A-Fa-f]{1,4}:){7}[0–9A-Fa-f]{1,4})|(([0–9A-Fa-f]{1,4}:){6}:[0–9A-Fa-f]{1,4})|(([0–9A-Fa-f]{1,4}:){5}:([0–9A-Fa-f]{1,4}:)?[0–9A-Fa-f]{1,4})|(([0–9A-Fa-f]{1,4}:){4}:([0–9A-Fa-f]{1,4}:){0,2}[0–9A-Fa-f]{1,4})|(([0–9A-Fa-f]{1,4}:){3}:([0–9A-Fa-f]{1,4}:){0,3}[0–9A-Fa-f]{1,4})|(([0–9A-Fa-f]{1,4}:){2}:([0–9A-Fa-f]{1,4}:){0,4}[0–9A-Fa-f]{1,4})|(([0–9A-Fa-f]{1,4}:){6}((b((25[0–5])|(1d{2})|(2[0–4]d)|(d{1,2}))b).){3}(b((25[0–5])|(1d{2})|(2[0–4]d)|(d{1,2}))b))|(([0–9A-Fa-f]{1,4}:){0,5}:((b((25[0–5])|(1d{2})|(2[0–4]d)|(d{1,2}))b).){3}(b((25[0–5])|(1d{2})|(2[0–4]d)|(d{1,2}))b))|(::([0–9A-Fa-f]{1,4}:){0,5}((b((25[0–5])|(1d{2})|(2[0–4]d)|(d{1,2}))b).){3}(b((25[0–5])|(1d{2})|(2[0–4]d)|(d{1,2}))b))|([0–9A-Fa-f]{1,4}::([0–9A-Fa-f]{1,4}:){0,5}[0–9A-Fa-f]{1,4})|(::([0–9A-Fa-f]{1,4}:){0,6}[0–9A-Fa-f]{1,4})|(([0–9A-Fa-f]{1,4}:){1,7}:))$/,
|
||||||
telephonefr: /^0[1-9][0-9]{9}$/,
|
telephonefr: /^0[1-9][0-9]{8}$/,
|
||||||
telephoneinter: /^\+*(\d{3})*[0-9,\-]{8,}/,
|
telephoneinter: /^\+*(\d{3})*[0-9,\-]{8,}/,
|
||||||
password:
|
password:
|
||||||
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&.])[A-Za-z\d$@$!%*?&.{}:|\s]{8,}/,
|
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&.])[A-Za-z\d$@$!%*?&.{}:|\s]{8,}/,
|
||||||
|
@ -35,6 +35,7 @@ Notifications.get = (alias, tribeId) => {
|
|||||||
*/
|
*/
|
||||||
Notifications.registertolist = (key, typekey, tribe, mlist, srckey, uuid) => {
|
Notifications.registertolist = (key, typekey, tribe, mlist, srckey, uuid) => {
|
||||||
key = key.toLowerCase();
|
key = key.toLowerCase();
|
||||||
|
typekey= (typekey=="telephone")? "telephonefr":typekey;
|
||||||
if (!Checkjson.testformat(key, typekey))
|
if (!Checkjson.testformat(key, typekey))
|
||||||
return {
|
return {
|
||||||
status: 400,
|
status: 400,
|
||||||
|
@ -66,8 +66,9 @@ router.post("/registeranonymous",checkHeaders,(req,res)=>{
|
|||||||
if (!req.body.typekey || !['email','telephone'].includes(req.body.typekey) ){
|
if (!req.body.typekey || !['email','telephone'].includes(req.body.typekey) ){
|
||||||
return res.status(406).json({status:406,ref:"Notifications",msg:"typekeyunknown",data:{typekey:req.body.typekey}})
|
return res.status(406).json({status:406,ref:"Notifications",msg:"typekeyunknown",data:{typekey:req.body.typekey}})
|
||||||
}
|
}
|
||||||
|
const key= (req.body.contactpoint)?req.body.contactpoint:req.body[req.body.typekey];
|
||||||
result= Notifications.registertolist(
|
result= Notifications.registertolist(
|
||||||
req.body[req.body.typekey],
|
key,
|
||||||
req.body.typekey,
|
req.body.typekey,
|
||||||
req.body.tribe,
|
req.body.tribe,
|
||||||
req.body.mlist,
|
req.body.mlist,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user