Skip to content

Commit

Permalink
Merge pull request #125 from skychatorg/dev/7ph
Browse files Browse the repository at this point in the history
Add twitch support & Mutl-fixes and minor improvements
  • Loading branch information
7PH authored Jun 20, 2021
2 parents ec461cf + 3876728 commit 0491114
Show file tree
Hide file tree
Showing 40 changed files with 556 additions and 115 deletions.
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
backups
build
dist
node_modules
storage
uploads
.env.json
build/
dist/
node_modules/
.idea
.vscode
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RUN ln -s /var/skychat/storage ./storage
RUN ln -s /var/skychat/uploads ./uploads

# Copy build configuration
COPY package*.json gulpfile.js tsconfig.*.json webpack.config.js ./
COPY package*.json gulpfile.js tsconfig.json webpack.config.js ./

# Copy application .env file
COPY .env.json ./
Expand Down
44 changes: 20 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,38 +61,32 @@ This is not all, but to discover all features, you may as well launch an instanc

## How to install

### Install and run
### Install in 30 seconds

If using docker you need:
- docker & docker-compose
- docker
- docker-compose

If not using docker, ensure you have the following installed on your system:
- nodejs >= 10 and npm
- sqlite3
- nodejs >= 10
- sqlite3, zip, ffmpeg (e.g. `apt install -y sqlite3 zip ffmpeg`)

Then, follow these steps:
Then, follow these 2 steps:

```bash
# 1. Clone the repository
git clone https://github.com/skychatorg/skychat.git
cd skychat
# 1. Use the autoinstall script (Clones the repository then executes scripts/setup.sh)
bash <(wget -q https://raw.githubusercontent.com/skychatorg/skychat/master/scripts/autoinstall.sh -O -) && cd skychat

# 2. Generates the .env.json and config files in config/
bash scripts/setup.sh

# 3. (Choose only one) Run the app
# Run with docker:
# 2.A. Run the app in docker
bash scripts/docker-start.sh
# Run on current host
npm i && npm run start
# 2.B. Run the app on your local host
npm i && npm start
```


### Application setup

By default, the application will be listening to `localhost:8080` and assume it is accessed from `http://localhost:8080`. In order to customize the domain name of your SkyChat application, you will need to edit the `.env.json` file. The fields in the .env.json contain private information related to the application.

The semantic of these fields are defined below:
By default, the application will be listening to `localhost:8080` and assume it is accessed from `http://localhost:8080`. In order to customize the domain name of your SkyChat application, edit the `.env.json` file. The fields in the .env.json contain the private variables of the application, listed below:


| field | type | default | semantic |
Expand Down Expand Up @@ -127,15 +121,15 @@ Using the Youtube API is free but there is a daily quota, which when exceeded bl
npm run dev
```

This will start a static file server & websocket server on http://localhost:8080
When the source files change, the build processes runs automatically
This will start a static file server & websocket server, available under the location specified in the `.env.json` file.
When the source files change, the build processes runs automatically.

## Customize


### Customize preferences

The preferences.json file specifies application preferences. The available fields are detailed below.
The `config/preferences.json` file specifies application preferences. The available fields are detailed below.


| field | type | default | description |
Expand All @@ -153,21 +147,23 @@ The preferences.json file specifies application preferences. The available field

### Customize plugins

Enabled plugins. Must only define classes exported by `app/server/skychat/commands/impl/index.ts`
The `config/plugins.txt` contains the list of enabled plugins.
To add a custom plugin, create a plugin object in `app/server/skychat/plugins/user_defined/` then add its name to `config/plugins.txt`.


### Customize ranks

Rank definition (xp threshold and image path). Must be sorted by descending limit. The fields for each rank are:
`config/ranks.json` contains the rank definition (xp threshold and rank icon paths). Must be sorted by descending limit. The fields for each rank are:
- limit: XP limit to have this rank. The last rank definition must have `0` as the limit, otherwise new users will not have any rank.
- images: Image path corresponding to the rank icon for each 18 and 26px sizes. Image paths should be relative to `/assets/images/`.


### Customize the fake message history

This file contains the fake raw messages that are displayed to users whose right level is less than `minRightForMessageHistory` defined in `preferences.json`.
`config/fakemessages.txt` contains the fake messages shown to users whose right level is less than `minRightForMessageHistory` defined in `preferences.json`. If `minRightForMessageHistory` is set to -1, you do not need to modify the fake messages since not one will see them.


### Customize guest names

`config/guestnames.txt` is the pool of non-logged usernames.
When a guest logs in, a random name is associated to its session. These names are randomly used from this file. If you want to change these names, keep in mind that they should not contain whitespace characters (anything matched by \s so newline, tab, space, ..). Default random names are animal names.
Binary file added app/client/assets/assets/images/icons/twitch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions app/client/src/SkyChatClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ export class SkyChatClient extends EventEmitter {
this.on('auth-token', this.onAuthToken.bind(this));
this.on('typing-list', this.onTypingList.bind(this));
this.on('cursor', this.onCursor.bind(this));
this.on('info', this.onInfo.bind(this));
this.on('error', this.onError.bind(this));
this.on('roll', this.onRoll.bind(this));

this.on('file-list', this.onFileList.bind(this));
this.on('file-content', this.onFileContent.bind(this));

this.on('gallery', this.onGallery.bind(this));
this.on('gallery-search', this.onGallerySearchResults.bind(this));
Expand Down Expand Up @@ -452,6 +456,20 @@ export class SkyChatClient extends EventEmitter {
this.store.commit("SET_ROLL_STATE", roll.state);
}

/**
*
*/
onFileList(files) {
this.store.commit("SET_FILE_LIST", files)
}

/**
*
*/
onFileContent(data) {
this.store.commit("SET_FILE_CONTENT", data);
}

/**
*
*/
Expand Down Expand Up @@ -481,6 +499,19 @@ export class SkyChatClient extends EventEmitter {
this.store.commit('SET_PLAYER_CHANNEL', channelId);
}

/**
*
*/
onInfo(info) {
new Noty({
type: 'info',
layout: 'topCenter',
theme: 'nest',
text: info,
timeout: 10 * 1000
}).show();
}

/**
*
*/
Expand Down
41 changes: 39 additions & 2 deletions app/client/src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,47 @@ const store = {
gallerySearchResults: null,
isGalleryVisible: false,

/**
* List of current shown cursors on the screen
*/
cursors: {},

rollState: null,

/**
* List of files that can be edited
*/
files: [],

/**
* Currently edited file
* @type {null | { filePath: string, content: string }}
*/
file: null,

/**
*
*/
messages: [],
playerEnabled: false,

/**
* Current list of typing users
*/
typingList: [],

/**
* Whether the player is on/off on the client side
*/
playerEnabled: false,

/**
* List of on-going polls
*/
polls: {},


/**
* Player state
*/
playerApiSearchResult: {},
playerChannels: [],
playerChannel: null,
Expand Down Expand Up @@ -332,6 +363,12 @@ const store = {
rollEndSound.play();
}
},
SET_FILE_LIST(state, files) {
state.files = files;
},
SET_FILE_CONTENT(state, data) {
state.file = data;
},
SET_PLAYER_API_SEARCH_RESULTS(state, result) {
state.playerApiSearchResult = result;
},
Expand Down
Loading

0 comments on commit 0491114

Please sign in to comment.