diff --git a/Gruntfile.js b/Gruntfile.js index 6df0c023a..5aaa13dff 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -2,13 +2,11 @@ module.exports = function (grunt) { var paths = { - dist: 'dist', - jade: 'views/**/**/*.jade', css: 'public/stylesheets/*.css', scss: 'public/stylesheets/application.scss', vendor: 'public/stylesheets/vendor', js: 'public/javascripts/*.js', - routes: 'controllers/**/*.js', + routes: './server/controllers/**/*.js', main: './server.js', browserified: 'public/javascripts/bundle.js', img: 'public/images/*.{png,jpg,jpeg,gif,webp,svg}', diff --git a/public/images/favicon.png b/client/app/images/favicon.png similarity index 100% rename from public/images/favicon.png rename to client/app/images/favicon.png diff --git a/public/images/loading.gif b/client/app/images/loading.gif similarity index 100% rename from public/images/loading.gif rename to client/app/images/loading.gif diff --git a/public/javascripts/index.js b/client/app/javascripts/index.js similarity index 100% rename from public/javascripts/index.js rename to client/app/javascripts/index.js diff --git a/public/stylesheets/application.scss b/client/app/stylesheets/application.scss similarity index 100% rename from public/stylesheets/application.scss rename to client/app/stylesheets/application.scss diff --git a/public/stylesheets/base.scss b/client/app/stylesheets/base.scss similarity index 100% rename from public/stylesheets/base.scss rename to client/app/stylesheets/base.scss diff --git a/public/stylesheets/bootstrap-variables.scss b/client/app/stylesheets/bootstrap-variables.scss similarity index 100% rename from public/stylesheets/bootstrap-variables.scss rename to client/app/stylesheets/bootstrap-variables.scss diff --git a/public/stylesheets/index.scss b/client/app/stylesheets/index.scss similarity index 100% rename from public/stylesheets/index.scss rename to client/app/stylesheets/index.scss diff --git a/server.js b/server.js index c971982b3..5f474a196 100644 --- a/server.js +++ b/server.js @@ -14,7 +14,7 @@ var WebSocketServer = require('ws').Server var app = express() // ----------- Checker ----------- -var checker = require('./initializers/checker') +var checker = require('./server/initializers/checker') var miss = checker.checkConfig() if (miss.length !== 0) { @@ -25,16 +25,16 @@ checker.createDirectoriesIfNotExist() // ----------- PeerTube modules ----------- var config = require('config') -var constants = require('./initializers/constants') -var customValidators = require('./helpers/customValidators') -var database = require('./initializers/database') -var logger = require('./helpers/logger') -var peertubeCrypto = require('./helpers/peertubeCrypto') -var poolRequests = require('./lib/poolRequests') -var routes = require('./controllers') -var utils = require('./helpers/utils') -var videos = require('./lib/videos') -var webtorrent = require('./lib/webtorrent') +var constants = require('./server/initializers/constants') +var customValidators = require('./server/helpers/customValidators') +var database = require('./server/initializers/database') +var logger = require('./server/helpers/logger') +var peertubeCrypto = require('./server/helpers/peertubeCrypto') +var poolRequests = require('./server/lib/poolRequests') +var routes = require('./server/controllers') +var utils = require('./server/helpers/utils') +var videos = require('./server/lib/videos') +var webtorrent = require('./server/lib/webtorrent') // Get configurations var port = config.get('listen.port') @@ -67,11 +67,7 @@ app.use(require('connect-livereload')({ require('segfault-handler').registerHandler() // Static files -app.use(express.static(path.join(__dirname, '/public'), { maxAge: 0 })) - -// Jade template from ./views directory -app.set('views', path.join(__dirname, '/views')) -app.set('view engine', 'jade') +app.use(express.static(path.join(__dirname, '/app'), { maxAge: 0 })) // API routes var api_route = '/api/' + constants.API_VERSION diff --git a/controllers/api/v1/index.js b/server/controllers/api/v1/index.js similarity index 100% rename from controllers/api/v1/index.js rename to server/controllers/api/v1/index.js diff --git a/controllers/api/v1/pods.js b/server/controllers/api/v1/pods.js similarity index 100% rename from controllers/api/v1/pods.js rename to server/controllers/api/v1/pods.js diff --git a/controllers/api/v1/remoteVideos.js b/server/controllers/api/v1/remoteVideos.js similarity index 100% rename from controllers/api/v1/remoteVideos.js rename to server/controllers/api/v1/remoteVideos.js diff --git a/controllers/api/v1/videos.js b/server/controllers/api/v1/videos.js similarity index 100% rename from controllers/api/v1/videos.js rename to server/controllers/api/v1/videos.js diff --git a/controllers/index.js b/server/controllers/index.js similarity index 100% rename from controllers/index.js rename to server/controllers/index.js diff --git a/controllers/views.js b/server/controllers/views.js similarity index 100% rename from controllers/views.js rename to server/controllers/views.js diff --git a/helpers/customValidators.js b/server/helpers/customValidators.js similarity index 100% rename from helpers/customValidators.js rename to server/helpers/customValidators.js diff --git a/helpers/logger.js b/server/helpers/logger.js similarity index 100% rename from helpers/logger.js rename to server/helpers/logger.js diff --git a/helpers/peertubeCrypto.js b/server/helpers/peertubeCrypto.js similarity index 100% rename from helpers/peertubeCrypto.js rename to server/helpers/peertubeCrypto.js diff --git a/helpers/requests.js b/server/helpers/requests.js similarity index 100% rename from helpers/requests.js rename to server/helpers/requests.js diff --git a/helpers/utils.js b/server/helpers/utils.js similarity index 100% rename from helpers/utils.js rename to server/helpers/utils.js diff --git a/initializers/checker.js b/server/initializers/checker.js similarity index 100% rename from initializers/checker.js rename to server/initializers/checker.js diff --git a/initializers/constants.js b/server/initializers/constants.js similarity index 100% rename from initializers/constants.js rename to server/initializers/constants.js diff --git a/initializers/database.js b/server/initializers/database.js similarity index 100% rename from initializers/database.js rename to server/initializers/database.js diff --git a/lib/friends.js b/server/lib/friends.js similarity index 100% rename from lib/friends.js rename to server/lib/friends.js diff --git a/lib/poolRequests.js b/server/lib/poolRequests.js similarity index 100% rename from lib/poolRequests.js rename to server/lib/poolRequests.js diff --git a/lib/videos.js b/server/lib/videos.js similarity index 100% rename from lib/videos.js rename to server/lib/videos.js diff --git a/lib/webtorrent.js b/server/lib/webtorrent.js similarity index 100% rename from lib/webtorrent.js rename to server/lib/webtorrent.js diff --git a/lib/webtorrentProcess.js b/server/lib/webtorrentProcess.js similarity index 100% rename from lib/webtorrentProcess.js rename to server/lib/webtorrentProcess.js diff --git a/middlewares/cache.js b/server/middlewares/cache.js similarity index 100% rename from middlewares/cache.js rename to server/middlewares/cache.js diff --git a/middlewares/index.js b/server/middlewares/index.js similarity index 100% rename from middlewares/index.js rename to server/middlewares/index.js diff --git a/middlewares/reqValidators/index.js b/server/middlewares/reqValidators/index.js similarity index 100% rename from middlewares/reqValidators/index.js rename to server/middlewares/reqValidators/index.js diff --git a/middlewares/reqValidators/pods.js b/server/middlewares/reqValidators/pods.js similarity index 100% rename from middlewares/reqValidators/pods.js rename to server/middlewares/reqValidators/pods.js diff --git a/middlewares/reqValidators/remote.js b/server/middlewares/reqValidators/remote.js similarity index 100% rename from middlewares/reqValidators/remote.js rename to server/middlewares/reqValidators/remote.js diff --git a/middlewares/reqValidators/utils.js b/server/middlewares/reqValidators/utils.js similarity index 100% rename from middlewares/reqValidators/utils.js rename to server/middlewares/reqValidators/utils.js diff --git a/middlewares/reqValidators/videos.js b/server/middlewares/reqValidators/videos.js similarity index 100% rename from middlewares/reqValidators/videos.js rename to server/middlewares/reqValidators/videos.js diff --git a/middlewares/secure.js b/server/middlewares/secure.js similarity index 100% rename from middlewares/secure.js rename to server/middlewares/secure.js diff --git a/models/pods.js b/server/models/pods.js similarity index 100% rename from models/pods.js rename to server/models/pods.js diff --git a/models/poolRequests.js b/server/models/poolRequests.js similarity index 100% rename from models/poolRequests.js rename to server/models/poolRequests.js diff --git a/models/videos.js b/server/models/videos.js similarity index 100% rename from models/videos.js rename to server/models/videos.js diff --git a/tests/api/checkParams.js b/server/tests/api/checkParams.js similarity index 100% rename from tests/api/checkParams.js rename to server/tests/api/checkParams.js diff --git a/tests/api/fixtures/video_short.mp4 b/server/tests/api/fixtures/video_short.mp4 similarity index 100% rename from tests/api/fixtures/video_short.mp4 rename to server/tests/api/fixtures/video_short.mp4 diff --git a/tests/api/fixtures/video_short.ogv b/server/tests/api/fixtures/video_short.ogv similarity index 100% rename from tests/api/fixtures/video_short.ogv rename to server/tests/api/fixtures/video_short.ogv diff --git a/tests/api/fixtures/video_short.webm b/server/tests/api/fixtures/video_short.webm similarity index 100% rename from tests/api/fixtures/video_short.webm rename to server/tests/api/fixtures/video_short.webm diff --git a/tests/api/fixtures/video_short1.webm b/server/tests/api/fixtures/video_short1.webm similarity index 100% rename from tests/api/fixtures/video_short1.webm rename to server/tests/api/fixtures/video_short1.webm diff --git a/tests/api/fixtures/video_short2.webm b/server/tests/api/fixtures/video_short2.webm similarity index 100% rename from tests/api/fixtures/video_short2.webm rename to server/tests/api/fixtures/video_short2.webm diff --git a/tests/api/fixtures/video_short3.webm b/server/tests/api/fixtures/video_short3.webm similarity index 100% rename from tests/api/fixtures/video_short3.webm rename to server/tests/api/fixtures/video_short3.webm diff --git a/tests/api/fixtures/video_short_fake.webm b/server/tests/api/fixtures/video_short_fake.webm similarity index 100% rename from tests/api/fixtures/video_short_fake.webm rename to server/tests/api/fixtures/video_short_fake.webm diff --git a/tests/api/friendsAdvanced.js b/server/tests/api/friendsAdvanced.js similarity index 100% rename from tests/api/friendsAdvanced.js rename to server/tests/api/friendsAdvanced.js diff --git a/tests/api/friendsBasic.js b/server/tests/api/friendsBasic.js similarity index 100% rename from tests/api/friendsBasic.js rename to server/tests/api/friendsBasic.js diff --git a/tests/api/index.js b/server/tests/api/index.js similarity index 100% rename from tests/api/index.js rename to server/tests/api/index.js diff --git a/tests/api/multiplePods.js b/server/tests/api/multiplePods.js similarity index 100% rename from tests/api/multiplePods.js rename to server/tests/api/multiplePods.js diff --git a/tests/api/singlePod.js b/server/tests/api/singlePod.js similarity index 100% rename from tests/api/singlePod.js rename to server/tests/api/singlePod.js diff --git a/tests/api/utils.js b/server/tests/api/utils.js similarity index 100% rename from tests/api/utils.js rename to server/tests/api/utils.js diff --git a/tests/index.js b/server/tests/index.js similarity index 100% rename from tests/index.js rename to server/tests/index.js diff --git a/views/error.jade b/views/error.jade deleted file mode 100644 index d9e8a7893..000000000 --- a/views/error.jade +++ /dev/null @@ -1,8 +0,0 @@ -extends layout - -block content - h1= message - if error - h2= error.status - pre #{error.stack} - diff --git a/views/footer.jade b/views/footer.jade deleted file mode 100644 index c7754f584..000000000 --- a/views/footer.jade +++ /dev/null @@ -1,3 +0,0 @@ -footer - - | PeerTube, CopyLeft 2015 diff --git a/views/header.jade b/views/header.jade deleted file mode 100644 index 6b84333f9..000000000 --- a/views/header.jade +++ /dev/null @@ -1,9 +0,0 @@ -.navbar.navbar-default - .container-fluid - .navbar-header - a.navbar-brand(href='/') PeerTube - .navbar-header - form.navbar-form(role='search') - .form-group.search-group - input.form-control#search-video(type='text' name='search_video' placeholder='Search a video...') - a.search-btn.btn.btn-link.glyphicon.glyphicon-search(type='submit') \ No newline at end of file diff --git a/views/index.jade b/views/index.jade deleted file mode 100644 index a49758fc0..000000000 --- a/views/index.jade +++ /dev/null @@ -1,15 +0,0 @@ -extends layout - -block content - div(class='container') - div(class='row') - include panel - - div(id='ajax_load' class='col-md-9') - - - include footer - - // build:js /javascripts/global.min.js - script(src='/javascripts/bundle.js') - // endbuild diff --git a/views/layout.jade b/views/layout.jade deleted file mode 100644 index 43c28cd4f..000000000 --- a/views/layout.jade +++ /dev/null @@ -1,15 +0,0 @@ -doctype html -html - head - link(rel='icon' type='image/png' href='/images/favicon.png') - meta(name='viewport' content='width=device-width, initial-scale=1') - title= title - - // build:css /stylesheets/global.min.css - each file in [ 'global' ] - link(rel='stylesheet', href='/stylesheets/' + file + '.css') - // endbuild - - body - include header - block content diff --git a/views/panel.jade b/views/panel.jade deleted file mode 100644 index 0d124fb7e..000000000 --- a/views/panel.jade +++ /dev/null @@ -1,17 +0,0 @@ -menu(class='col-md-2') - - div(id='panel_get_videos' class='panel_button') - span(class='glyphicon glyphicon-list') - | Get videos - - div(id='panel_upload_video' class='panel_button') - span(class='glyphicon glyphicon-cloud-upload') - | Upload a video - - div(id='panel_make_friends' class='panel_button') - span(class='glyphicon glyphicon-user') - | Make friends - - div(id='panel_quit_friends' class='panel_button') - span(class='glyphicon glyphicon-plane') - | Quit friends