From 5958f8c0ff10cc0967f72b3d8281338747ed5dc5 Mon Sep 17 00:00:00 2001 From: knotteye Date: Tue, 24 Sep 2019 18:35:11 -0500 Subject: [PATCH] Moved readme, started documentation. --- docs/INSTALLING.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++ docs/README.md | 16 +++++++++++++ src/database.ts | 1 - 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 docs/INSTALLING.md create mode 100644 docs/README.md diff --git a/docs/INSTALLING.md b/docs/INSTALLING.md new file mode 100644 index 0000000..616326b --- /dev/null +++ b/docs/INSTALLING.md @@ -0,0 +1,57 @@ +##Installing Satyr +A generic guide for install satyr. Example commands are provided for distributions based on debian and arhc. + +###Preparing the system +It is reccomended to create a system user to run satyr. +```bash +adduser satyr -D /var/lib/satyr -m -r -U +``` +Install ffmpeg and mysql with your package manager. +```bash +sudo apt install ffmpeg mysql +pacman -S ffmpeg mysql +``` + +###Installing NodeJS + +####Installing on distributions with a compatible version of node +If your distribution ships with a compatible version of node(stable, >=10), you can install it with your distribution's package manager. +```bash +sudo apt install nodejs +``` +You can verify the version with +```bash +node --verion +``` +####Installing on distributions with an incompatible version of node +If the version provided by your disribution is not a new enough version, is a nightly build (such as Arch), you will need to get a compatible version from [nodejs.org](https://nodejs.org/en/downloads) and add the binaries to your path. +```bash +wget https://nodejs.org/dist/path/to/download.tar.xz +tar -xf node-v10.something.tar.xz +``` +Add the /bin folder to your path (and the path of the satyr user), or symlink the binaries. +```bash +sudo ln -sf node-v10.something/bin/node /usr/bin +sudo ln -sf node-v10.something/bin/npm /usr/bin +sudo ln -sf node-v10.something/bin/npx /usr/bin +``` + +Alternatively, use a tool like [nvm](https://github.com/nvm-sh/nvm) to manage your current node version. + +###Install Satyr +Clone the satyr repo to a folder such as /opt/satyr or /var/lib/satyr and make satyr the owner of the folder. +```bash +sudo mkdir -p /opt/satyr +sudo chown -R satyr:satyr /opt/satyr +sudo -Hu satyr git clone https://gitlab.com/knotteye/satyr.git /opt/satyr +``` +Change to the satyr directory and install dependecies. It will ask you a few questions to generate an initial config. +```bash +cd /opt/satyr +npm install +``` +Build and start the server. +```bash +npm run build +npm start +``` \ No newline at end of file diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..0bea53b --- /dev/null +++ b/docs/README.md @@ -0,0 +1,16 @@ +##Satyr: A livestreaming server + +System dependencies: A stable version of node>=10, mysql3 (or a compatible implementation such as MariaDB), and ffmpeg >=4.2 + +###Build Instructions +```bash +git clone https://gitlab.com/knotteye/satyr.git +cd satyr +npm install +npm run build +``` + +###Run the server +```bash +npm start +``` \ No newline at end of file diff --git a/src/database.ts b/src/database.ts index e3c50ce..5665db0 100644 --- a/src/database.ts +++ b/src/database.ts @@ -18,7 +18,6 @@ async function addUser(name: string, password: string, streamer: boolean, admin: let hash: string = await bcrypt.hash(password, cryptoconfig.saltRounds); let dupe = await query('select * from users where username=\''+name+'\''); if(dupe[0]) return false; - //INSERT INTO users (username, password_hash, stream_key, record_flag, is_mod) VALUES ('name', 'hash', 'key', 0, admin); let q: string = 'INSERT INTO users (username, password_hash, stream_key, record_flag, is_mod) VALUES (\''+name+'\', \''+hash+'\', \''+key+'\', 0, '+admin+')'; await query(q); return true;