Skip to content

Commit

Permalink
Merge pull request #65 from Adamant-im/dev
Browse files Browse the repository at this point in the history
v0.8.0
  • Loading branch information
martiliones authored Jan 14, 2023
2 parents 98e674a + 43f7a99 commit 5214996
Show file tree
Hide file tree
Showing 26 changed files with 28,065 additions and 27,813 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Install EditorConfig Plugin on your IDE for one coding style
# EditorConfig is awesome: http://EditorConfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
[*.md]
max_line_length = off
trim_trailing_whitespace = false
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# ADAMANT

ADAMANT is a **decentralized blockchain messaging platform**. Applications use ADAMANT as an anonymous and encrypted relay and storage to enable messaging features. As examples, see [Messenger app](https://github.com/Adamant-im/adamant-im), [Blockchain 2FA](https://github.com/Adamant-im/adamant-2fa) and [Decentralized cryptocurrency exchanger](https://github.com/Adamant-im/adamant-exchangebot) implementations.
ADAMANT is a **decentralized blockchain messaging platform**. Applications use ADAMANT as an anonymous and encrypted relay and storage to enable messaging features. As examples, see [Messenger app](https://github.com/Adamant-im/adamant-im), [Blockchain 2FA](https://github.com/Adamant-im/adamant-2fa) and [Cryptocurrency Exchanger](https://github.com/Adamant-im/adamant-exchangebot) implementations.

For more information refer to ADAMANT website: <https://adamant.im>.

![ADAMANT nodes](./docs/adm-nodes.jpeg)
![ADAMANT nodes](./img/adm-nodes.jpeg)

Additional information:

Expand All @@ -25,9 +25,9 @@ The manual describes API endpoints to manage accounts, transactions, chats, and

### Requirements

- Ubuntu 18/20 (others are not tested)
- Ubuntu 18/20/22 (others are not tested)
- 2 GB RAM
- 50 GB disk space as on August 2021
- 60 GB disk space as on November 2022

### Installation script

Expand Down Expand Up @@ -61,15 +61,15 @@ F. e.,
System wide via package manager:

```
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
```

Locally using nvm:

```
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
nvm i --lts=fermium
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
nvm i --lts=gallium
```

- Install PostgreSQL:
Expand Down Expand Up @@ -168,8 +168,8 @@ npm run test:single test/api/accounts.js

## Authors

- ADAMANT Foundation: Aleksei Lebedev <[email protected]>
- ADAMANT Tech Labs: Aleksei Lebedev, Dmitriy Soloduhin, Sergey Ushakov <[email protected]>
- ADAMANT Foundation <[email protected]>
- ADAMANT TECH LABS LP <[email protected]>
- Boris Povod <[email protected]>
- Pavel Nekrasov <[email protected]>
- Sebastian Stupurac <[email protected]>
Expand All @@ -180,8 +180,10 @@ npm run test:single test/api/accounts.js

## License

Copyright © 2020-2021 ADAMANT Foundation
Copyright © 2020-2022 ADAMANT Foundation

Copyright © 2017-2020 ADAMANT TECH LABS LP

Copyright © 2016-2017 Lisk Foundation

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Expand All @@ -194,7 +196,8 @@ You should have received a copy of the [GNU General Public License](https://gith

This program also incorporates work previously released with lisk `0.7.0` (and earlier) versions under the [MIT License](https://opensource.org/licenses/MIT). To comply with the requirements of that license, the following permission notice, applicable to those parts of the code only, is included below:

Copyright © 2016-2017 Lisk Foundation
Copyright © 2016-2017 Lisk Foundation

Copyright © 2015 Crypti

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Expand Down
2 changes: 1 addition & 1 deletion api/http/chatrooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const httpApi = require('../../helpers/httpApi');
*/
// Constructor
function ChatroomsHttpApi (chatroomsModule, app) {
const router = new Router();
const router = new Router({ caseSensitive: false });

router.map(chatroomsModule.internal, {
'get /U*/U*': 'getMessages',
Expand Down
26 changes: 20 additions & 6 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ d.run(function () {
throw Error(e);
}

if (!appConfig.cors) {
appConfig.cors = { origin: true };
}

appConfig.cors.credentials = true;

if (appConfig.dapp.masterrequired && !appConfig.dapp.masterpassword) {
var randomstring = require('randomstring');

Expand Down Expand Up @@ -278,8 +284,14 @@ d.run(function () {
* `emit`.
*/
clientWs: ['config', function (scope, cb) {
var ClientWs = require('./modules/clientWs');
cb(null, new ClientWs(scope.config.wsClient, logger));
const ClientWs = require('./modules/clientWs');

const clientWs = new ClientWs(
Object.assign(scope.config.wsClient, { cors: appConfig.cors }),
logger
);

cb(null, clientWs);
}],
/**
* Once config is completed, creates app, http & https servers & sockets with express.
Expand Down Expand Up @@ -307,14 +319,15 @@ d.run(function () {
app.use(compression({
level: 9
}));
app.use(cors());
app.options('*', cors());
app.use(cors(appConfig.cors));
app.options('*', cors(appConfig.cors));

var server = require('http').createServer(app);

const { Server } = require('socket.io');
const io = new Server(server, {
allowEIO3: true
allowEIO3: true,
cors: appConfig.cors
});

var privateKey, certificate, https, https_io;
Expand All @@ -330,7 +343,8 @@ d.run(function () {
}, app);

https_io = new Server(https, {
allowEIO3: true
allowEIO3: true,
cors: appConfig.cors
});
}

Expand Down
234 changes: 123 additions & 111 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,115 +1,127 @@
{
"port": 36666,
"address": "0.0.0.0",
"fileLogLevel": "warn",
"logFileName": "logs/adamant.log",
"consoleLogLevel": "info",
"trustProxy": false,
"topAccounts": false,
"cacheEnabled": false,
"db": {
"host": "localhost",
"port": 5432,
"database": "adamant_main",
"user": "adamant",
"password": "password",
"poolSize": 95,
"poolIdleTimeout": 30000,
"reapIntervalMillis": 1000,
"logEvents": [
"error"
]
"port": 36666,
"address": "0.0.0.0",
"fileLogLevel": "warn",
"logFileName": "logs/adamant.log",
"consoleLogLevel": "info",
"trustProxy": false,
"topAccounts": false,
"cacheEnabled": false,
"db": {
"host": "localhost",
"port": 5432,
"database": "adamant_main",
"user": "adamant",
"password": "password",
"poolSize": 95,
"poolIdleTimeout": 30000,
"reapIntervalMillis": 1000,
"logEvents": [
"error"
]
},
"redis": {
"url": "redis://127.0.0.1:6379/0",
"password": null
},
"api": {
"enabled": true,
"access": {
"public": false,
"whiteList": [
"127.0.0.1"
]
},
"redis": {
"url": "redis://127.0.0.1:6379/0",
"password": null
"options": {
"limits": {
"max": 0,
"delayMs": 0,
"delayAfter": 0,
"windowMs": 60000
}
}
},
"peers": {
"enabled": true,
"list": [
{
"ip": "51.15.221.205",
"port": 36666
},
{
"ip": "51.15.88.53",
"port": 36666
},
{
"ip": "5.161.68.61",
"port": 36666
},
{
"ip": "78.47.205.206",
"port": 36666
},
{
"ip": "107.161.26.184",
"port": 36666
},
{
"ip": "138.201.152.191",
"port": 36666
}
],
"access": {
"blackList": []
},
"api": {
"enabled": true,
"access": {
"public": false,
"whiteList": [
"127.0.0.1"
]
},
"options": {
"limits": {
"max": 0,
"delayMs": 0,
"delayAfter": 0,
"windowMs": 60000
}
}
},
"peers": {
"enabled": true,
"list": [
{
"ip": "51.15.221.205",
"port": 36666
},
{
"ip": "51.15.88.53",
"port": 36666
},
{
"ip": "51.15.217.230",
"port": 36666
}
],
"access": {
"blackList": []
},
"options": {
"limits": {
"max": 0,
"delayMs": 0,
"delayAfter": 0,
"windowMs": 60000
},
"timeout": 5000
}
},
"broadcasts": {
"broadcastInterval": 1500,
"broadcastLimit": 20,
"parallelLimit": 20,
"releaseLimit": 25,
"relayLimit": 3
},
"transactions": {
"maxTxsPerQueue": 1000
},
"forging": {
"force": false,
"secret": [],
"access": {
"whiteList": [
"127.0.0.1"
]
}
},
"loading": {
"verifyOnLoading": false,
"loadPerIteration": 5000
},
"ssl": {
"enabled": false,
"options": {
"port": 443,
"address": "0.0.0.0",
"key": "./ssl/adamant.key",
"cert": "./ssl/adamant.crt"
}
},
"dapp": {
"masterrequired": true,
"masterpassword": "",
"autoexec": []
},
"wsClient": {
"portWS": 36668,
"enabled": true
},
"nethash": "bd330166898377fb28743ceef5e43a5d9d0a3efd9b3451fb7bc53530bb0a6d64"
"options": {
"limits": {
"max": 0,
"delayMs": 0,
"delayAfter": 0,
"windowMs": 60000
},
"timeout": 5000
}
},
"broadcasts": {
"broadcastInterval": 1500,
"broadcastLimit": 20,
"parallelLimit": 20,
"releaseLimit": 25,
"relayLimit": 4
},
"transactions": {
"maxTxsPerQueue": 1000
},
"forging": {
"force": false,
"secret": [],
"access": {
"whiteList": [
"127.0.0.1"
]
}
},
"loading": {
"verifyOnLoading": false,
"loadPerIteration": 5000
},
"ssl": {
"enabled": false,
"options": {
"port": 443,
"address": "0.0.0.0",
"key": "./ssl/adamant.key",
"cert": "./ssl/adamant.crt"
}
},
"dapp": {
"masterrequired": true,
"masterpassword": "",
"autoexec": []
},
"wsClient": {
"portWS": 36668,
"enabled": true
},
"nethash": "bd330166898377fb28743ceef5e43a5d9d0a3efd9b3451fb7bc53530bb0a6d64"
}
Loading

0 comments on commit 5214996

Please sign in to comment.