Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Leon Klingele committed Nov 5, 2015
0 parents commit f63e938
Show file tree
Hide file tree
Showing 34 changed files with 2,550 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config/config.php
extra/static/config/OwnCloudConfig.js
49 changes: 49 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
language: php
php:
- 5.4
- 5.5
- 5.6
- hhvm

env:
global:
- BRANCH=master
matrix:
- DB=mysql

matrix:
allow_failures:
- php: hhvm
include:
- php: 5.4
env: DB=sqlite
- php: 5.4
env: DB=pgsql


install:
# install ocdev
- sudo apt-get -y install python3-jinja2 python3-setuptools
- sudo easy_install3 requests
- sudo easy_install3 ocdev
# set up postgresql
- createuser -U travis -s oc_autotest
# set up mysql
- mysql -e 'create database oc_autotest;'
- mysql -u root -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY '';"
- mysql -u root -e "grant all on oc_autotest.* to 'oc_autotest'@'localhost';"
# install owncloud
- cd ..
- ocdev setup core --dir owncloud --branch $BRANCH --no-history
- mv spreedwebrtc owncloud/apps
- phpenv config-add owncloud/apps/spreedwebrtc/tests/travis/php.ini
- cd owncloud
- ./occ maintenance:install --database-name oc_autotest --database-user oc_autotest --database-pass --admin-user admin --admin-pass admin --database $DB
- ./occ app:enable spreedwebrtc

before_script:
- cd apps/spreedwebrtc

script:
- phpunit -c phpunit.xml
- phpunit -c phpunit.integration.xml
4 changes: 4 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Authors

* Leon: <[email protected]>

16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
owncloud-spreedwebrtc (0.1.2)
* Fourth release

owncloud-spreedwebrtc (0.1.0)
* Third release
* Third release
* Third release
* Multiline
test

owncloud-spreedwebrtc (0.0.2)
* Second release
* Second release

owncloud-spreedwebrtc (0.0.1)
* Initial release
661 changes: 661 additions & 0 deletions COPYING

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Makefile for building the project

app_name=spreedwebrtc
project_dir=$(CURDIR)/../$(app_name)
build_dir=$(CURDIR)/build/artifacts
appstore_dir=$(build_dir)/appstore
source_dir=$(build_dir)/source
package_name=$(app_name)

all: dist

clean:
rm -rf $(build_dir)

dist: clean
mkdir -p $(source_dir)
tar cvzf $(source_dir)/$(package_name).tar.gz $(project_dir) \
--exclude-vcs \
--exclude=$(project_dir)/build/artifacts \
--exclude=$(project_dir)/js/node_modules \
--exclude=$(project_dir)/js/coverage

appstore_package: clean
mkdir -p $(appstore_dir)
tar cvzf $(appstore_dir)/$(package_name).tar.gz $(project_dir) \
--exclude-vcs \
--exclude=$(project_dir)/build \
--exclude=$(project_dir)/js/node_modules \
--exclude=$(project_dir)/js/.bowerrc \
--exclude=$(project_dir)/js/.jshintrc \
--exclude=$(project_dir)/js/Gruntfile.js \
--exclude=$(project_dir)/js/*.json \
--exclude=$(project_dir)/js/*.conf.js \
--exclude=$(project_dir)/js/*.log \
--exclude=$(project_dir)/js/README.md \
--exclude=$(project_dir)/js/.bowerrc \
--exclude=$(project_dir)/.travis.yml \
--exclude=$(project_dir)/phpunit*xml \
--exclude=$(project_dir)/Makefile \
--exclude=$(project_dir)/tests
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Spreed WebRTC ownCloud app
- This ownCloud app can only be used in conjunction with a [Spreed WebRTC server](https://github.com/strukturag/spreed-webrtc).
- You will not be able to use this app without such a server, but it's **easy to set** one – Only takes about 5 minutes.

## Features
- When set up, you can securely communicate with your friends and family using rich audio-, video- and text chat, share presentations and other documents, share your computer screen, share YouTube videos and much more
- Only allow registered ownCloud users to use the WebRTC server
- Easily share your ownCloud presentations, photos, and other documents

## Installation / Setup of this app
1. Place this app in the **apps/** folder of your ownCloud installation.
2. Set up a Spreed WebRTC server and continue with the next step.
An easy-to-follow installation guideline can be found further below ("**Installation / Setup of a Spreed WebRTC server**").
3. You now should have a running Spreed WebRTC server.
4. This app requires you to change some settings in the `server.conf` of the Spreed WebRTC server, namely:
1. In the **[http]** section:
- Enable **basePath** and adjust to e.g. **/webrtc/**
(e.g. `basePath = /webrtc/`)
2. In the **[app]** section:
- Enable **authorizeRoomJoin** and set it to **true**
(`authorizeRoomJoin = true`)
- Enable **extra** and set it to the full path of the **spreedwebrtc/extra** directory in your **apps** folder of your ownCloud installation
(e.g. `extra = /absolute/path/to/owncloud/apps/spreedwebrtc/extra`)
- Enable **plugin** and set it to **extra/static/owncloud.js**
(`plugin = extra/static/owncloud.js`)
3. In the **[users]** section:
- Enable **enabled** and set it to **true**
(``enabled = true``)
- Enable **mode** and set it to **sharedsecret**
(`mode = sharedsecret`)
- Enable **sharedsecret_secret** and set it to a random 64-character HEX string.
**Please note:** Do **NOT** use the string given below. Generate your own random 64-character HEX string.
(e.g. `sharedsecret_secret = bb04fb058e2d7fd19c5bdaa129e7883195f73a9c49414a7eXXXXXXXXXXXXXXXX`)
4. Restart the Spreed WebRTC server for it to reload its configuration
5. Head over to the **apps/spreedwebrtc/config** folder in your ownCloud installation. Copy `config.php.in` to `config.php` and adjust the constants **SPREED_WEBRTC_BASEPATH** and **SPREED_WEBRTC_SHAREDSECRET** as already done in `server.conf`.
6. **That's it.** You can now start communicating securely with your friends and family by opening **/index.php/apps/spreedwebrtc** in your browser.

## Installation / Setup of a Spreed WebRTC server
1. Head over to [github.com/strukturag/spreed-webrtc](https://github.com/strukturag/spreed-webrtc) and follow the instructions to install the Spreed WebRTC server.





## Publish to App Store

First get an account for the [App Store](http://apps.owncloud.com/) then run:

make appstore_package

The archive is located in build/artifacts/appstore and can then be uploaded to the App Store.

## Running tests
After [Installing PHPUnit](http://phpunit.de/getting-started.html) run:

phpunit -c phpunit.xml
42 changes: 42 additions & 0 deletions appinfo/app.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
/**
* ownCloud - spreedwebrtc
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Leon <[email protected]>
* @copyright Leon 2015
*/

namespace OCA\SpreedWebRTC\AppInfo;

use OCA\SpreedWebRTC\Settings\Settings;
use OCP\AppFramework\App;

$app = new App(Settings::APP_ID);
$container = $app->getContainer();

$container->query('OCP\INavigationManager')->add(function () use ($container) {
$urlGenerator = $container->query('OCP\IURLGenerator');
$l10n = $container->query('OCP\IL10N');
return [
// the string under which your app will be referenced in owncloud
'id' => Settings::APP_ID,

// sorting weight for the navigation. The higher the number, the higher
// will it be listed in the navigation
'order' => 10,

// the route that will be shown on startup
'href' => $urlGenerator->linkToRoute('spreedwebrtc.page.index'),

// the icon that will be shown in the navigation
// this file needs to exist in img/
'icon' => $urlGenerator->imagePath(Settings::APP_ID, Settings::APP_ICON),

// the title of your application. This will be used in the
// navigation or on the settings page of your app
'name' => $l10n->t(Settings::APP_TITLE),
];
});
18 changes: 18 additions & 0 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<info>
<id>spreedwebrtc</id>
<name>Spreed WebRTC</name>
<description>spreed-webrtc - https://github.com/strukturag/spreed-webrtc</description>
<licence>AGPL</licence>
<author>struktur AG</author>
<documentation>
<user>../README.md</user>
<admin>../README.md</admin>
</documentation>
<version>0.0.1</version>
<namespace>SpreedWebRTC</namespace>
<category>other</category>
<dependencies>
<owncloud min-version="8.1" />
</dependencies>
</info>
31 changes: 31 additions & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
* ownCloud - spreedwebrtc
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Leon <[email protected]>
* @copyright Leon 2015
*/

return [
'routes' => [
// Page
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
['name' => 'page#webrtc', 'url' => '/webrtc', 'verb' => 'GET'],
['name' => 'page#file_selector', 'url' => '/file-selector', 'verb' => 'GET'],
//['name' => 'page#install', 'url' => '/install', 'verb' => 'GET'],

// API
['name' => 'spreedwebrtcapi#get_csrf_token', 'url' => '/api/v1/tokenize', 'verb' => 'GET'],
['name' => 'spreedwebrtcapi#get_config', 'url' => '/api/v1/config', 'verb' => 'GET'],
['name' => 'spreedwebrtcapi#download_file', 'url' => '/api/v1/file/download', 'verb' => 'GET'],
//['name' => 'spreedwebrtcapi#login', 'url' => '/api/v1/user/login', 'verb' => 'POST'],
['name' => 'spreedwebrtcapi#get_user_config', 'url' => '/api/v1/user/config', 'verb' => 'GET'],
['name' => 'spreedwebrtcapi#get_login', 'url' => '/api/v1/user/login', 'verb' => 'GET'],
//['name' => 'spreedwebrtcapi#get_shares', 'url' => '/api/v1/user/shares', 'verb' => 'GET'],

['name' => 'spreedwebrtcapi#demo', 'url' => '/api/v1/demo', 'verb' => 'GET'],
],
];
69 changes: 69 additions & 0 deletions changelog/changelog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php
/**
* ownCloud - spreedwebrtc
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Leon <[email protected]>
* @copyright Leon 2015
*/

namespace OCA\SpreedWebRTC\Changelog;

use OCA\SpreedWebRTC\Helper\Helper;
use OCA\SpreedWebRTC\Settings\Settings;

class Changelog {

const CHANGELOG_FILE = 'CHANGELOG.md';

private function __construct() {

}

public static function getChangesSinceVersion($since) {
$changes_by_version = self::getAllChangesByRelease();
$changes_since_version = array();

foreach ($changes_by_version as $version => $changes) {
if (version_compare($since, $version) !== -1) {
continue;
}

$changes_since_version[$version] = $changes;
}

return $changes_since_version;
}

private static function getAllChangesByRelease() {
$version_regex = '/^owncloud-' . Settings::APP_ID . ' \((.*)\)/';
$contents = file_get_contents(Helper::getOwnAppPath() . self::CHANGELOG_FILE);
$releases = explode("\n\n", $contents);
$changes_by_version = array();

foreach ($releases as $release) {
list($version_line) = explode("\n", $release);
$changes = str_replace($version_line . "\n", '', $release);
$matches = array();
preg_match($version_regex, $release, $matches);
list($_tmp, $version) = $matches;
if ($version && !isset($changes_by_version[$version])) {
$changes = explode('*', $changes);
$changes_by_line = array();
foreach ($changes as $change) {
if (!empty($change)) {
// Replace multiple whitespaces, newlines, ..
$change = preg_replace('/\s+/', ' ', trim(str_replace("\n", '', $change)));
$changes_by_line[] = $change;
}
}
$changes_by_version[$version] = $changes_by_line;
}
}

return $changes_by_version;
}

}
33 changes: 33 additions & 0 deletions config/config.php.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* ownCloud - spreedwebrtc
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Leon <[email protected]>
* @copyright Leon 2015
*/

namespace OCA\SpreedWebRTC\Config;

class Config {

// Domain of your Spreed WebRTC server (including protocol and optional port number), examples:
//const SPREED_WEBRTC_ORIGIN = 'https://myowncloudserver.com';
//const SPREED_WEBRTC_ORIGIN = 'https://webrtc.myowncloudserver.com:8080';
const SPREED_WEBRTC_ORIGIN = '';

// This has to be the same `basePath`
// you already set in the [http] section of the `server.conf` file from Spreed WebRTC server
const SPREED_WEBRTC_BASEPATH = '/webrtc/';

// This has to be the same `sharedsecret_secret` (64-character HEX string)
// you already set in the [users] section of the `server.conf` file from Spreed WebRTC server
const SPREED_WEBRTC_SHAREDSECRET = 'bb04fb058e2d7fd19c5bdaa129e7883195f73a9c49414a7eXXXXXXXXXXXXXXXX';

private function __construct() {

}

}
Loading

0 comments on commit f63e938

Please sign in to comment.