forked from RocketChat/Rocket.Chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daniel Aquino
committed
May 28, 2024
1 parent
612c78a
commit 6f7047e
Showing
11 changed files
with
3,974 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
### Rocket.Chat configuration | ||
RC_DOCKERFILE = apps/meteor/.docker/Dockerfile | ||
# Rocket.Chat version | ||
# see:- https://github.com/RocketChat/Rocket.Chat/releases | ||
RELEASE= | ||
# MongoDB endpoint (include ?replicaSet= parameter) | ||
MONGO_URL=mongodb://mongo:27017/rocketchat \ | ||
# MongoDB endpoint to the local database | ||
MONGO_OPLOG_URL= | ||
# IP to bind the process to | ||
BIND_IP= | ||
# URL used to access your Rocket.Chat instance | ||
ROOT_URL= http://localhost:3000 | ||
# Port Rocket.Chat runs on (in-container) | ||
PORT=3000 | ||
# Port on the host to bind to | ||
HOST_PORT= | ||
|
||
### MongoDB configuration | ||
# MongoDB version/image tag | ||
MONGODB_VERSION= | ||
# See:- https://hub.docker.com/r/bitnami/mongodb | ||
|
||
### Traefik config (if enabled) | ||
# Traefik version/image tag | ||
TRAEFIK_RELEASE= | ||
# Domain for https (change ROOT_URL & BIND_IP accordingly) | ||
DOMAIN= | ||
# Email for certificate notifications | ||
LETSENCRYPT_EMAIL= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './test'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; | ||
|
||
import { dispatchToastMessage } from '../../../client/lib/toast'; | ||
import { sdk } from '../../utils/client/lib/SDKClient'; | ||
import { slashCommands } from '../../utils/lib/slashCommand'; | ||
|
||
slashCommands.add({ | ||
command: 'test', | ||
callback: async function Status({ params, userId }: SlashCommandCallbackParams<'test'>): Promise<void> { | ||
if (!userId) { | ||
return; | ||
} | ||
|
||
try { | ||
await sdk.call('setUserStatus', undefined, params); | ||
} catch (error) { | ||
dispatchToastMessage({ type: 'error', message: error }); | ||
} | ||
}, | ||
options: { | ||
description: 'Slash_Status_Description', | ||
params: 'Slash_Status_Params', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './test'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { api } from '@rocket.chat/core-services'; | ||
import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings'; | ||
import { Users } from '@rocket.chat/models'; | ||
|
||
import { i18n } from '../../../server/lib/i18n'; | ||
import { settings } from '../../settings/server'; | ||
import { setUserStatusMethod } from '../../user-status/server/methods/setUserStatus'; | ||
import { slashCommands } from '../../utils/lib/slashCommand'; | ||
|
||
slashCommands.add({ | ||
command: 'test', | ||
callback: async function Status({ params, message, userId }: SlashCommandCallbackParams<'test'>): Promise<void> { | ||
if (!userId) { | ||
return; | ||
} | ||
|
||
const user = await Users.findOneById(userId, { projection: { language: 1 } }); | ||
const lng = user?.language || settings.get('Language') || 'en'; | ||
|
||
try { | ||
await setUserStatusMethod(userId, undefined, params); | ||
|
||
void api.broadcast('notify.ephemeralMessage', userId, message.rid, { | ||
msg: i18n.t('StatusMessage_Changed_Successfully', { lng }), | ||
}); | ||
} catch (err: any) { | ||
if (err.error === 'error-not-allowed') { | ||
void api.broadcast('notify.ephemeralMessage', userId, message.rid, { | ||
msg: i18n.t('StatusMessage_Change_Disabled', { lng }), | ||
}); | ||
} | ||
|
||
throw err; | ||
} | ||
}, | ||
options: { | ||
description: 'Slash_Status_Description', | ||
params: 'Slash_Status_Params', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
volumes: | ||
mongodb_data: { driver: local } | ||
|
||
services: | ||
rocketchat: | ||
image: registry.rocket.chat/rocketchat/rocket.chat:${RELEASE:-latest} | ||
restart: always | ||
labels: | ||
traefik.enable: 'true' | ||
traefik.http.routers.rocketchat.rule: Host(`${DOMAIN:-}`) | ||
traefik.http.routers.rocketchat.tls: 'true' | ||
traefik.http.routers.rocketchat.entrypoints: https | ||
traefik.http.routers.rocketchat.tls.certresolver: le | ||
environment: | ||
MONGO_URL: "${MONGO_URL:-\ | ||
mongodb://${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/\ | ||
${MONGODB_DATABASE:-rocketchat}?replicaSet=${MONGODB_REPLICA_SET_NAME:-rs0}}" | ||
MONGO_OPLOG_URL: "${MONGO_OPLOG_URL:\ | ||
-mongodb://${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/\ | ||
local?replicaSet=${MONGODB_REPLICA_SET_NAME:-rs0}}" | ||
ROOT_URL: ${ROOT_URL:-http://localhost:${HOST_PORT:-3000}} | ||
PORT: ${PORT:-3000} | ||
DEPLOY_METHOD: docker | ||
DEPLOY_PLATFORM: ${DEPLOY_PLATFORM:-} | ||
REG_TOKEN: ${REG_TOKEN:-} | ||
depends_on: | ||
- mongodb | ||
expose: | ||
- ${PORT:-3000} | ||
ports: | ||
- '${BIND_IP:-0.0.0.0}:${HOST_PORT:-3000}:${PORT:-3000}' | ||
|
||
mongodb: | ||
image: docker.io/bitnami/mongodb:${MONGODB_VERSION:-5.0} | ||
restart: always | ||
volumes: | ||
- mongodb_data:/bitnami/mongodb | ||
environment: | ||
MONGODB_REPLICA_SET_MODE: primary | ||
MONGODB_REPLICA_SET_NAME: ${MONGODB_REPLICA_SET_NAME:-rs0} | ||
MONGODB_PORT_NUMBER: ${MONGODB_PORT_NUMBER:-27017} | ||
MONGODB_INITIAL_PRIMARY_HOST: ${MONGODB_INITIAL_PRIMARY_HOST:-mongodb} | ||
MONGODB_INITIAL_PRIMARY_PORT_NUMBER: ${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017} | ||
MONGODB_ADVERTISED_HOSTNAME: ${MONGODB_ADVERTISED_HOSTNAME:-mongodb} | ||
MONGODB_ENABLE_JOURNAL: ${MONGODB_ENABLE_JOURNAL:-true} | ||
ALLOW_EMPTY_PASSWORD: ${ALLOW_EMPTY_PASSWORD:-yes} |
Oops, something went wrong.