@session.js/consts 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -0
- package/dist/index.js +67 -0
- package/package.json +27 -0
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @session.js/consts
|
|
2
|
+
|
|
3
|
+
Session Desktop & Session.js constants
|
|
4
|
+
|
|
5
|
+
- `DURATION`
|
|
6
|
+
- `TTL_DEFAULT`
|
|
7
|
+
- `SWARM_POLLING_TIMEOUT`
|
|
8
|
+
- `PROTOCOLS`
|
|
9
|
+
- `CONVERSATION`
|
|
10
|
+
- `MAX_ATTACHMENT_FILESIZE_BYTES`
|
|
11
|
+
- `VALIDATION`
|
|
12
|
+
- `DEFAULT_RECENT_REACTS`
|
|
13
|
+
- `REACT_LIMIT`
|
|
14
|
+
- `MAX_USERNAME_BYTES`
|
|
15
|
+
- `FEATURE_RELEASE_TIMESTAMPS`
|
|
16
|
+
|
|
17
|
+
## Made for session.js
|
|
18
|
+
|
|
19
|
+
Use Session messenger programmatically with [Session.js](https://github.com/sessionjs/client): Session bots, custom Session clients, and more.
|
|
20
|
+
|
|
21
|
+
## Donate
|
|
22
|
+
|
|
23
|
+
[hloth.dev/donate](https://hloth.dev/donate)
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// CREDIT: OXEN, Session-Desktop
|
|
2
|
+
// github.com/oxen-io/session-desktop
|
|
3
|
+
const seconds = 1000;
|
|
4
|
+
const minutes = seconds * 60;
|
|
5
|
+
const hours = minutes * 60;
|
|
6
|
+
const days = hours * 24;
|
|
7
|
+
/** in milliseconds */
|
|
8
|
+
export const DURATION = {
|
|
9
|
+
/** 1000ms */
|
|
10
|
+
SECONDS: seconds,
|
|
11
|
+
/** 60 * 1000 = 60,000 ms */
|
|
12
|
+
MINUTES: minutes,
|
|
13
|
+
/** 60 * 60 * 1000 = 3,600,000 ms */
|
|
14
|
+
HOURS: hours,
|
|
15
|
+
/** 24 * 60 * 60 * 1000 = 86,400,000 ms */
|
|
16
|
+
DAYS: days,
|
|
17
|
+
/** 7 * 24 * 60 * 60 * 1000 = 604,800,000 ms */
|
|
18
|
+
WEEKS: days * 7,
|
|
19
|
+
};
|
|
20
|
+
export const TTL_DEFAULT = {
|
|
21
|
+
/** 20 seconds */
|
|
22
|
+
TYPING_MESSAGE: 20 * DURATION.SECONDS,
|
|
23
|
+
/** 5 minutes */
|
|
24
|
+
CALL_MESSAGE: 5 * 60 * DURATION.SECONDS,
|
|
25
|
+
/** 14 days */
|
|
26
|
+
CONTENT_MESSAGE: 14 * DURATION.DAYS,
|
|
27
|
+
/** 30 days */
|
|
28
|
+
CONFIG_MESSAGE: 30 * DURATION.DAYS,
|
|
29
|
+
};
|
|
30
|
+
export const SWARM_POLLING_TIMEOUT = {
|
|
31
|
+
/** 5 seconds */
|
|
32
|
+
ACTIVE: DURATION.SECONDS * 5,
|
|
33
|
+
/** 1 minute */
|
|
34
|
+
MEDIUM_ACTIVE: DURATION.SECONDS * 60,
|
|
35
|
+
/** 2 minutes */
|
|
36
|
+
INACTIVE: DURATION.SECONDS * 120,
|
|
37
|
+
};
|
|
38
|
+
export const PROTOCOLS = {
|
|
39
|
+
HTTP: 'http:',
|
|
40
|
+
HTTPS: 'https:',
|
|
41
|
+
};
|
|
42
|
+
export const CONVERSATION = {
|
|
43
|
+
DEFAULT_MEDIA_FETCH_COUNT: 50,
|
|
44
|
+
DEFAULT_DOCUMENTS_FETCH_COUNT: 100,
|
|
45
|
+
DEFAULT_MESSAGE_FETCH_COUNT: 30,
|
|
46
|
+
MAX_MESSAGE_FETCH_COUNT: 1000,
|
|
47
|
+
/** in seconds */
|
|
48
|
+
MAX_VOICE_MESSAGE_DURATION: 300,
|
|
49
|
+
MAX_CONVO_UNREAD_COUNT: 999,
|
|
50
|
+
MAX_GLOBAL_UNREAD_COUNT: 99,
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* The file server and onion request max upload size is 10MB precisely.
|
|
54
|
+
* 10MB is still ok, but one byte more is not.
|
|
55
|
+
*/
|
|
56
|
+
export const MAX_ATTACHMENT_FILESIZE_BYTES = 10 * 1000 * 1000;
|
|
57
|
+
export const VALIDATION = {
|
|
58
|
+
MAX_GROUP_NAME_LENGTH: 30,
|
|
59
|
+
CLOSED_GROUP_SIZE_LIMIT: 100,
|
|
60
|
+
};
|
|
61
|
+
export const DEFAULT_RECENT_REACTS = ['😂', '🥰', '😢', '😡', '😮', '😈'];
|
|
62
|
+
export const REACT_LIMIT = 6;
|
|
63
|
+
export const MAX_USERNAME_BYTES = 64;
|
|
64
|
+
export const FEATURE_RELEASE_TIMESTAMPS = {
|
|
65
|
+
DISAPPEARING_MESSAGES_V2: 1710284400000, // 13/03/2024 10:00 Melbourne time
|
|
66
|
+
USER_CONFIG: 1690761600000, // Monday July 31st at 10am Melbourne time
|
|
67
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@session.js/consts",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"module": "src/index.ts",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"author": "Viktor Shchelochkov <hi@hloth.dev> (https://hloth.dev)",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/sessionjs/consts.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/sessionjs/consts/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/sessionjs/consts#readme",
|
|
16
|
+
"description": "Session Desktop & Session.js constants",
|
|
17
|
+
"type": "module",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/index.js"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc --project tsconfig.build.json"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"typescript": "^5.0.0"
|
|
26
|
+
}
|
|
27
|
+
}
|