Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
indent_style = space
indent_size = 4
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# ignore modules pulled in from npm
node_modules/

# rc-apps package output
dist/

# JetBrains IDEs
out/
.idea/
.idea_modules/

# macOS
.DS_Store
.AppleDouble
.LSOverride
._*
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# vscode extensions
.vscode/
19 changes: 19 additions & 0 deletions .rcappsconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"url": "http://localhost:3000",
"username": "",
"password": "",
"ignoredFiles": [
"**/README.md",
"**/package-lock.json",
"**/package.json",
"**/tslint.json",
"**/tsconfig.json",
"**/*.js",
"**/*.js.map",
"**/*.d.ts",
"**/*.spec.ts",
"**/*.test.ts",
"**/dist/**",
"**/.*"
]
}
36 changes: 36 additions & 0 deletions BbbMeetApp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import {
IAppAccessors,
IConfigurationExtend,
ILogger,
} from '@rocket.chat/apps-engine/definition/accessors';
import { App } from '@rocket.chat/apps-engine/definition/App';
import { IAppInfo } from '@rocket.chat/apps-engine/definition/metadata';
import { JoinCommand } from './commands/JoinCommand';
import { ScheduleMeetCommand } from './commands/ScheduleMeetCommand';
import { weeklyNotification } from './reminder/processors/weeklyNotification';
import { AppSettings } from './settings/appsettings';
import { BbbSettings } from './settings/bbbsettings';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to clean up the imports.


export class BbbMeetApp extends App {

constructor(info: IAppInfo, logger: ILogger, accessors: IAppAccessors) {
super(info, logger, accessors);
}

protected async extendConfiguration(configuration: IConfigurationExtend): Promise<void> {

await Promise.all(AppSettings.map((setting) => configuration.settings.provideSetting(setting)));
await Promise.all(BbbSettings.map((setting) => configuration.settings.provideSetting(setting)));

await configuration.slashCommands.provideSlashCommand(new ScheduleMeetCommand())
await configuration.slashCommands.provideSlashCommand(new JoinCommand())

//Register processors
await configuration.scheduler.registerProcessors([
{
id : "weeklyreminder",
processor: weeklyNotification,
}
]);
}
}
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,52 @@
# Apps.BigBlueButton
# Apps.BigBlueButton

## 📙 About the App

An integration of Big Blue Button with Rocket.Chat for conducting a weekly meeting and maintaining the recording video archive. This Rocket.Chat App that will enable users in a channel to join an existing weekly meeting if it is in progress. Or query for recorded meeting videos and view them.

## 📝 What Apps.BigBlueButton does?

## 🚀 Steps to run

- Clone this Repository:
```
git clone https://github.com/RocketChat/Apps.BigBlueButton.git
```

- Change the Directory:
```
cd Apps.BigBlueButton
```

- Install the required dependencies:
```
npm install
```

- Make Sure you have Rocket.Chat server running on your localhost & you have [Rocket.Chat.Apps-cli](https://github.com/RocketChat/Rocket.Chat.Apps-cli) installed, if not :
```
npm install -g @rocket.chat/apps-cli
```

- Install the app:
```
rc-apps deploy --url http://localhost:3000 --username user_username --password user_password
```
Where:
- `http://localhost:3000` is your local server URL (if you are running in another port, change the 3000 to the appropriate port)
- `user_username` is the username of your admin user.
- `user_password` is the password of your admin user.

For more info refer [this](https://rocket.chat/docs/developer-guides/developing-apps/getting-started/) guide.

## 👨🏻‍💼 Documentation for reference

Here are some links to examples and documentation:
- [Rocket.Chat Apps TypeScript Definitions Documentation](https://rocketchat.github.io/Rocket.Chat.Apps-engine/)
- [Rocket.Chat Apps TypeScript Definitions Repository](https://github.com/RocketChat/Rocket.Chat.Apps-engine)
- [Example Rocket.Chat Apps](https://github.com/graywolf336/RocketChatApps)
- Community Forums
- [App Requests](https://forums.rocket.chat/c/rocket-chat-apps/requests)
- [App Guides](https://forums.rocket.chat/c/rocket-chat-apps/guides)
- [Top View of Both Categories](https://forums.rocket.chat/c/rocket-chat-apps)
- [#rocketchat-apps on Open.Rocket.Chat](https://open.rocket.chat/channel/rocketchat-apps)
203 changes: 203 additions & 0 deletions SHA1/sha1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
export function sha1(str: string): string {
const utf8 = str;
const words32 = stringToWords32(utf8, Endian.Big);
return _sha1(words32, utf8.length * 8);
}

export function sha1Binary(buffer: ArrayBuffer): string {
const words32 = arrayBufferToWords32(buffer, Endian.Big);
return _sha1(words32, buffer.byteLength * 8);
}

function _sha1(words32: number[], len: number): string {
const w = new Array(80);
let [a, b, c, d, e]: number[] = [0x67452301, 0xefcdab89, 0x98badcfe,
0x10325476, 0xc3d2e1f0];

words32[len >> 5] |= 0x80 << (24 - len % 32);
words32[((len + 64 >> 9) << 4) + 15] = len;

for (let i = 0; i < words32.length; i += 16) {
const [h0, h1, h2, h3, h4]: number[] = [a, b, c, d, e];

for (let j = 0; j < 80; j++) {
if (j < 16) {
w[j] = words32[i + j];
} else {
w[j] = rol32(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
}

const [f, k] = fk(j, b, c, d);
const temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32);
[e, d, c, b, a] = [d, c, rol32(b, 30), a, temp];
}

[a, b, c, d, e] = [add32(a, h0), add32(b, h1), add32(c, h2), add32(d, h3), add32(e, h4)];
}

return byteStringToHexString(words32ToByteString([a, b, c, d, e]));
}

function add32(a: number, b: number): number {
return add32to64(a, b)[1];
}

function add32to64(a: number, b: number): [number, number] {
const low = (a & 0xffff) + (b & 0xffff);
const high = (a >>> 16) + (b >>> 16) + (low >>> 16);
return [high >>> 16, (high << 16) | (low & 0xffff)];
}

function add64([ah, al]: [number, number], [bh, bl]: [number, number]): [number, number] {
const [carry, l] = add32to64(al, bl);
const h = add32(add32(ah, bh), carry);
return [h, l];
}

function sub32(a: number, b: number): number {
const low = (a & 0xffff) - (b & 0xffff);
const high = (a >> 16) - (b >> 16) + (low >> 16);
return (high << 16) | (low & 0xffff);
}

// Rotate a 32b number left 'count' position
function rol32(a: number, count: number): number {
return (a << count) | (a >>> (32 - count));
}

// Rotate a 64b number left 'count' position
function rol64([hi, lo]: [number, number], count: number): [number, number] {
const h = (hi << count) | (lo >>> (32 - count));
const l = (lo << count) | (hi >>> (32 - count));
return [h, l];
}

enum Endian {
Little,
Big,
}

function fk(index: number, b: number, c: number, d: number): [number, number] {
if (index < 20) {
return [(b & c) | (~b & d), 0x5a827999];
}

if (index < 40) {
return [b ^ c ^ d, 0x6ed9eba1];
}

if (index < 60) {
return [(b & c) | (b & d) | (c & d), 0x8f1bbcdc];
}

return [b ^ c ^ d, 0xca62c1d6];
}


function stringToWords32(str: string, endian: Endian): number[] {
const words32 = Array((str.length + 3) >>> 2);

for (let i = 0; i < words32.length; i++) {
words32[i] = wordAt(str, i * 4, endian);
}

return words32;
}

function arrayBufferToWords32(buffer: ArrayBuffer, endian: Endian): number[] {
const words32 = Array((buffer.byteLength + 3) >>> 2);
const view = new Uint8Array(buffer);
for (let i = 0; i < words32.length; i++) {
words32[i] = wordAt(view, i * 4, endian);
}
return words32;
}

function byteAt(str: string | Uint8Array, index: number): number {
if (typeof str === 'string') {
return index >= str.length ? 0 : str.charCodeAt(index) & 0xff;
} else {
return index >= str.byteLength ? 0 : str[index] & 0xff;
}
}

function wordAt(str: string | Uint8Array, index: number, endian: Endian): number {
let word = 0;
if (endian === Endian.Big) {
for (let i = 0; i < 4; i++) {
word += byteAt(str, index + i) << (24 - 8 * i);
}
} else {
for (let i = 0; i < 4; i++) {
word += byteAt(str, index + i) << 8 * i;
}
}
return word;
}

function words32ToByteString(words32: number[]): string {
return words32.reduce((str, word) => str + word32ToByteString(word), '');
}

function word32ToByteString(word: number): string {
let str = '';
for (let i = 0; i < 4; i++) {
str += String.fromCharCode((word >>> 8 * (3 - i)) & 0xff);
}
return str;
}

function byteStringToHexString(str: string): string {
let hex: string = '';
for (let i = 0; i < str.length; i++) {
const b = byteAt(str, i);
hex += (b >>> 4).toString(16) + (b & 0x0f).toString(16);
}
return hex.toLowerCase();
}

// based on http://www.danvk.org/hex2dec.html (JS can not handle more than
// 56b)
function byteStringToDecString(str: string): string {
let decimal = '';
let toThePower = '1';

for (let i = str.length - 1; i >= 0; i--) {
decimal = addBigInt(decimal, numberTimesBigInt(byteAt(str, i),
toThePower));
toThePower = numberTimesBigInt(256, toThePower);
}

return decimal.split('').reverse().join('');
}

// x and y decimal, lowest significant digit first
function addBigInt(x: string, y: string): string {
let sum = '';
const len = Math.max(x.length, y.length);
for (let i = 0, carry = 0; i < len || carry; i++) {
const tmpSum = carry + +(x[i] || 0) + +(y[i] || 0);
if (tmpSum >= 10) {
carry = 1;
sum += tmpSum - 10;
} else {
carry = 0;
sum += tmpSum;
}
}

return sum;
}


function numberTimesBigInt(num: number, b: string): string {
let product = '';
let bToThePower = b;
for (; num !== 0; num = num >>> 1) {
if (num & 1) product = addBigInt(product, bToThePower);
bToThePower = addBigInt(bToThePower, bToThePower);
}
return product;
}

//borrowed from https://github.com/angular/angular/blob/master/packages/service-worker/cli/sha1.ts
16 changes: 16 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"id": "0dc8312a-f8aa-44cb-bbef-a9e9cf88f243",
"version": "0.0.1",
"requiredApiVersion": "^1.19.0",
"iconFile": "icon.png",
"author": {
"name": "Aswini",
"homepage": "github.com/aswinidev",
"support": "github.com/aswinidev"
},
"name": "bbb.meet",
"nameSlug": "bbbmeet",
"classFile": "BbbMeetApp.ts",
"description": "A weekly meeting and video archiving system",
"implements": []
}
Loading