├── .eslintrc ├── .gitignore ├── LICENSE ├── README.md ├── app ├── app.html ├── assets │ ├── images │ │ └── background.jpg │ └── stylesheets │ │ ├── _animations.scss │ │ ├── _loading.scss │ │ ├── _side_nav.scss │ │ ├── _variables.scss │ │ └── main.scss ├── components │ ├── App │ │ ├── App.vue │ │ ├── AppBar.vue │ │ ├── Error.vue │ │ ├── Infos.vue │ │ ├── SideNav.vue │ │ └── draft.vue │ ├── Player │ │ └── Player.vue │ └── Show │ │ ├── Season.vue │ │ ├── ShowDetails.vue │ │ ├── ShowItem.vue │ │ ├── ShowList.vue │ │ ├── Torrent.vue │ │ └── curated │ │ ├── CuratedListItem.vue │ │ └── CuratedListList.vue ├── i18n │ ├── locales.js │ └── nokat.js ├── index.js ├── services │ ├── engine.js │ ├── parse.js │ └── subs.js ├── store │ └── store.js └── utils │ ├── escapeActions.js │ └── strings.js ├── logo.png ├── main.js ├── package.js ├── package.json ├── server.js ├── webpack.config.base.js ├── webpack.config.development.js ├── webpack.config.production.js └── webpack.node.js /.eslintrc: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "env": { 4 | "browser": true, 5 | "node": true 6 | }, 7 | 8 | "ecmaFeatures": { 9 | "arrowFunctions": true, 10 | "destructuring": true, 11 | "classes": true, 12 | "defaultParams": true, 13 | "blockBindings": true, 14 | "modules": true, 15 | "objectLiteralComputedProperties": true, 16 | "objectLiteralShorthandMethods": true, 17 | "objectLiteralShorthandProperties": true, 18 | "restParams": true, 19 | "spread": true, 20 | "templateStrings": true 21 | }, 22 | 23 | "rules": { 24 | "accessor-pairs": 2, 25 | "array-bracket-spacing": 0, 26 | "block-scoped-var": 0, 27 | "brace-style": [2, "1tbs", { "allowSingleLine": true }], 28 | "camelcase": 0, 29 | "comma-dangle": [2, "never"], 30 | "comma-spacing": [2, { "before": false, "after": true }], 31 | "comma-style": [2, "last"], 32 | "complexity": 0, 33 | "computed-property-spacing": 0, 34 | "consistent-return": 0, 35 | "consistent-this": 0, 36 | "constructor-super": 2, 37 | "curly": [2, "multi-line"], 38 | "default-case": 0, 39 | "dot-location": [2, "property"], 40 | "dot-notation": 0, 41 | "eol-last": 0, 42 | "eqeqeq": [2, "allow-null"], 43 | "func-names": 0, 44 | "func-style": 0, 45 | "generator-star-spacing": [2, { "before": true, "after": true }], 46 | "guard-for-in": 0, 47 | "handle-callback-err": [2, "^(err|error)$" ], 48 | "key-spacing": [2, { "beforeColon": false, "afterColon": true }], 49 | "linebreak-style": 0, 50 | "lines-around-comment": 0, 51 | "max-nested-callbacks": 0, 52 | "new-cap": [2, { "newIsCap": true, "capIsNew": false }], 53 | "new-parens": 2, 54 | "newline-after-var": 0, 55 | "no-alert": 0, 56 | "no-array-constructor": 2, 57 | "no-caller": 2, 58 | "no-catch-shadow": 0, 59 | "no-cond-assign": 2, 60 | "no-console": 0, 61 | "no-constant-condition": 0, 62 | "no-continue": 0, 63 | "no-control-regex": 2, 64 | "no-debugger": 2, 65 | "no-delete-var": 2, 66 | "no-div-regex": 0, 67 | "no-dupe-args": 2, 68 | "no-dupe-keys": 2, 69 | "no-duplicate-case": 2, 70 | "no-else-return": 0, 71 | "no-empty": 0, 72 | "no-empty-character-class": 2, 73 | "no-empty-label": 2, 74 | "no-eq-null": 0, 75 | "no-eval": 2, 76 | "no-ex-assign": 2, 77 | "no-extend-native": 2, 78 | "no-extra-bind": 2, 79 | "no-extra-boolean-cast": 2, 80 | "no-extra-parens": 0, 81 | "no-extra-semi": 0, 82 | "no-fallthrough": 2, 83 | "no-floating-decimal": 2, 84 | "no-func-assign": 2, 85 | "no-implied-eval": 2, 86 | "no-inline-comments": 0, 87 | "no-inner-declarations": [2, "functions"], 88 | "no-invalid-regexp": 2, 89 | "no-irregular-whitespace": 2, 90 | "no-iterator": 2, 91 | "no-label-var": 2, 92 | "no-labels": 2, 93 | "no-lone-blocks": 2, 94 | "no-lonely-if": 0, 95 | "no-loop-func": 0, 96 | "no-mixed-requires": 0, 97 | "no-mixed-spaces-and-tabs": 2, 98 | "no-multi-spaces": 2, 99 | "no-multi-str": 2, 100 | "no-multiple-empty-lines": [2, { "max": 1 }], 101 | "no-native-reassign": 2, 102 | "no-negated-in-lhs": 2, 103 | "no-nested-ternary": 0, 104 | "no-new": 2, 105 | "no-new-func": 0, 106 | "no-new-object": 2, 107 | "no-new-require": 2, 108 | "no-new-wrappers": 2, 109 | "no-obj-calls": 2, 110 | "no-octal": 2, 111 | "no-octal-escape": 2, 112 | "no-param-reassign": 0, 113 | "no-path-concat": 0, 114 | "no-process-env": 0, 115 | "no-process-exit": 0, 116 | "no-proto": 0, 117 | "no-redeclare": 2, 118 | "no-regex-spaces": 2, 119 | "no-restricted-modules": 0, 120 | "no-return-assign": 2, 121 | "no-script-url": 0, 122 | "no-self-compare": 2, 123 | "no-sequences": 2, 124 | "no-shadow": 0, 125 | "no-shadow-restricted-names": 2, 126 | "no-spaced-func": 2, 127 | "no-sparse-arrays": 2, 128 | "no-sync": 0, 129 | "no-ternary": 0, 130 | "no-this-before-super": 2, 131 | "no-throw-literal": 2, 132 | "no-trailing-spaces": 2, 133 | "no-undef": 2, 134 | "no-undef-init": 2, 135 | "no-undefined": 0, 136 | "no-underscore-dangle": 0, 137 | "no-unexpected-multiline": 2, 138 | "no-unneeded-ternary": 2, 139 | "no-unreachable": 2, 140 | "no-unused-expressions": 0, 141 | "no-unused-vars": [2, { "vars": "all", "args": "none" }], 142 | "no-use-before-define": 0, 143 | "no-var": 0, 144 | "no-void": 0, 145 | "no-warning-comments": 0, 146 | "no-with": 2, 147 | "object-curly-spacing": 0, 148 | "object-shorthand": 0, 149 | "one-var": [2, { "initialized": "never" }], 150 | "operator-assignment": 0, 151 | "operator-linebreak": [2, "after", { "overrides": { "?": "before", ":": "before" } }], 152 | "padded-blocks": 0, 153 | "prefer-const": 0, 154 | "quote-props": 0, 155 | "quotes": [2, "single", "avoid-escape"], 156 | "radix": 2, 157 | "semi": [2, "never"], 158 | "semi-spacing": 0, 159 | "sort-vars": 0, 160 | "space-after-keywords": [2, "always"], 161 | "space-before-blocks": [2, "always"], 162 | "space-before-function-paren": [2, "always"], 163 | "space-in-parens": [2, "never"], 164 | "space-infix-ops": 2, 165 | "space-return-throw-case": 2, 166 | "space-unary-ops": [2, { "words": true, "nonwords": false }], 167 | "spaced-comment": [2, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!"] }], 168 | "strict": 0, 169 | "use-isnan": 2, 170 | "valid-jsdoc": 0, 171 | "valid-typeof": 2, 172 | "vars-on-top": 0, 173 | "wrap-iife": [2, "any"], 174 | "wrap-regex": 0, 175 | "yoda": [2, "never"] 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 27 | node_modules 28 | 29 | # OSX 30 | .DS_Store 31 | 32 | # App packaged 33 | dist 34 | release 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Lawd-desktop 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # **Lawd** 2 | 3 | ---------- 4 | 5 | # Videos 6 | Lawd uses a parse server as its backend to store videos (movies and tv series). 7 | The torrents from the tracker api are transformed and filtered in our parse server. 8 | 9 | On the frontend, I used Vue.js and I find it extremely powerful library for building simple UI. 10 | For streaming, I was caught by the simplicity of use of WebTorrent.js. 11 | So I would like to thank these two fellas for making lawd alive. 12 | But to not forget the kat who offered me rapid access to their daily dump api. 13 | 14 | ## Install 15 | 16 | First, clone the repo via git 17 | And then install dependencies. 18 | 19 | ```bash 20 | $ npm install 21 | ``` 22 | 23 | ## Run 24 | 25 | Run this two commands __simultaneously__ in different console tabs. 26 | 27 | ```bash 28 | $ npm run hot-server 29 | $ npm run start-hot 30 | ``` 31 | 32 | or run two servers with one command 33 | 34 | ```bash 35 | $ npm run dev 36 | ``` 37 | -------------------------------------------------------------------------------- /app/app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Lawd 6 | 16 | 17 | 18 | 19 |
20 | 21 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/assets/images/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoufa88/lawd-desktop/114e6b4daaec86f6f0c2de13e95184214ad74562/app/assets/images/background.jpg -------------------------------------------------------------------------------- /app/assets/stylesheets/_animations.scss: -------------------------------------------------------------------------------- 1 | 2 | .fade-transition { 3 | transition: all .3s ease; 4 | } 5 | 6 | /* .expand-enter defines the starting state for entering */ 7 | /* .expand-leave defines the ending state for leaving */ 8 | .fade-enter, .fade-leave { 9 | opacity: 0.1; 10 | } 11 | -------------------------------------------------------------------------------- /app/assets/stylesheets/_loading.scss: -------------------------------------------------------------------------------- 1 | 2 | .loading{ 3 | background: #fff; 4 | } 5 | 6 | /* 7 | * Usage: 8 | * 9 |
10 | * 11 | */ 12 | .loading { 13 | width: 40px; 14 | height: 40px; 15 | margin: 110px auto; 16 | background-color: #fff; 17 | border-radius: 100%; 18 | -webkit-animation: sk-pulseScaleOut 1s infinite ease-in-out; 19 | animation: sk-pulseScaleOut 1s infinite ease-in-out; } 20 | 21 | @-webkit-keyframes sk-pulseScaleOut { 22 | 0% { 23 | -webkit-transform: scale(0); 24 | transform: scale(0); } 25 | 100% { 26 | -webkit-transform: scale(1); 27 | transform: scale(1); 28 | opacity: 0; } } 29 | 30 | @keyframes sk-pulseScaleOut { 31 | 0% { 32 | -webkit-transform: scale(0); 33 | transform: scale(0); } 34 | 100% { 35 | -webkit-transform: scale(1); 36 | transform: scale(1); 37 | opacity: 0; } } 38 | -------------------------------------------------------------------------------- /app/assets/stylesheets/_side_nav.scss: -------------------------------------------------------------------------------- 1 | .navbar-toggler:focus { 2 | border: none; 3 | outline: none; 4 | } 5 | 6 | #side-menu { 7 | position: fixed; 8 | left: -$side-menu-width; 9 | top: 54px; 10 | height: 100%; 11 | width: $side-menu-width; 12 | background-color: #333; 13 | transition:left 0.2s linear; 14 | 15 | button { 16 | font-size: 2rem; 17 | transform: rotateZ(-90deg); 18 | transition: transform 1s; 19 | margin-top: 50%; 20 | &:hover { 21 | transform: rotateZ(0deg); 22 | } 23 | } 24 | 25 | #nav-footer { 26 | position: absolute; 27 | bottom: 65px; 28 | color: #fff; 29 | } 30 | 31 | > ul { 32 | .nav-item { 33 | border-bottom: 1px solid #424242; 34 | 35 | &:first-child { 36 | border-top: 1px solid #424242; 37 | } 38 | 39 | .nav-item-link { 40 | display: block; 41 | color: #6C7B83; 42 | font-size: 14px; 43 | font-weight: bold; 44 | text-transform: uppercase; 45 | padding: $side-menu-padding-left/2 $side-menu-padding-left; 46 | 47 | &:hover, &:focus, &.is-active { 48 | text-decoration: none; 49 | color: #fff; 50 | } 51 | } 52 | } 53 | } 54 | } 55 | 56 | .side-menu-open { 57 | #side-menu { 58 | left: 0; 59 | } 60 | 61 | .movie-list:not(.loading) { 62 | padding-left: $side-menu-width; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/assets/stylesheets/_variables.scss: -------------------------------------------------------------------------------- 1 | $font-family-sans-serif: Raleway, Arial, sans-serif; 2 | $font-family-serif: Georgia, "Times New Roman", Times, serif; 3 | $font-family-monospace: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 4 | $font-family-base: $font-family-sans-serif; 5 | 6 | $brand-primary: brown; 7 | $brand-success: #5cb85c; 8 | $brand-info: #5bc0de; 9 | $brand-warning: #f0ad4e; 10 | $brand-danger: #d9534f; 11 | $brand-background: #333; 12 | $brand-accent: #2c3e50; 13 | 14 | $body-bg: $brand-background; 15 | $navbar-bg: $brand-primary; 16 | 17 | $btn-secondary-color: #fff !default; 18 | $btn-secondary-bg: $brand-accent !default; 19 | $btn-secondary-border: darken($btn-secondary-bg, 3%) !default; 20 | 21 | $side-menu-width: 250px; 22 | $side-menu-padding-left: 25px; 23 | $enable-flex: true !default; 24 | $popover-max-width: 350px !default; 25 | $navbar-border-radius: 0px !default; 26 | 27 | $popover-bg: $brand-accent !default; 28 | $popover-title-bg: darken($popover-bg, 3%) !default; 29 | -------------------------------------------------------------------------------- /app/assets/stylesheets/main.scss: -------------------------------------------------------------------------------- 1 | @import url(https://fonts.googleapis.com/css?family=Raleway:400,900,700italic,700,400italic,300,900italic); 2 | @import './_variables'; 3 | @import '~bootstrap/scss/bootstrap.scss'; 4 | // @import '~animate.css/animate.min.css'; 5 | @import '~font-awesome/css/font-awesome.css'; 6 | @import '~video.js/dist/video-js.css'; 7 | @import './_loading'; 8 | @import './_side_nav'; 9 | @import './_animations'; 10 | 11 | html { 12 | overflow: hidden; 13 | -webkit-user-select: none; 14 | cursor: default; 15 | } 16 | 17 | ::-webkit-scrollbar { 18 | width: 13px; 19 | background-color: rgb(40, 40, 40); 20 | } 21 | 22 | ::-webkit-scrollbar-thumb { 23 | border: 1px solid rgb(40, 40, 40); 24 | border-radius: 10px; 25 | background: linear-gradient(to right, rgb(90, 90, 90), rgb(80, 80, 80)); 26 | } 27 | 28 | ::-webkit-scrollbar-track { 29 | background-color: rgb(40, 40, 40); 30 | } 31 | 32 | .bg-inverse { 33 | background: $navbar-bg; 34 | } 35 | 36 | .close { 37 | position: absolute; 38 | top: 11%; 39 | right: 5%; 40 | font-size: 4rem; 41 | font-weight: 500; 42 | color: #E4E4E4; 43 | opacity: 1; 44 | &:hover { 45 | color: #fff; 46 | } 47 | } 48 | 49 | #main-content { 50 | margin-top: 54px; 51 | padding: 25px 0; 52 | overflow-y: auto; 53 | overflow-x: hidden; 54 | height: calc(100vh - 54px); 55 | background: $body-bg; 56 | } 57 | 58 | .btn-primary:hover, 59 | .btn-primary:active, 60 | .btn-primary:focus 61 | .btn-secondary:hover, 62 | .btn-secondary:active, 63 | .btn-secondary:focus { 64 | border: 1px solid #fff; 65 | outline: 0; 66 | } 67 | 68 | .btn-transparent, .btn-transparent:hover { 69 | background: transparent; 70 | color: white; 71 | border: none; 72 | outline: none; 73 | } 74 | 75 | // -------------------------- Popovers ---------------------------------- 76 | 77 | .popover-title { 78 | color: #fff; 79 | } 80 | 81 | .popover-content { 82 | max-height: 16rem; 83 | overflow: auto; 84 | color: #eee; 85 | } 86 | 87 | // -------------------------- App bar ---------------------------------- 88 | 89 | .navbar-brand { 90 | text-transform: uppercase; 91 | font-weight: 900; 92 | } 93 | 94 | .sort-button { 95 | margin-right: 75px; 96 | } 97 | 98 | .search-control { 99 | height: 38px; 100 | font-size: 14px; 101 | width: 15rem !important; 102 | } 103 | 104 | .sort-control { 105 | padding-top: 3px; 106 | } 107 | 108 | // --------------------------- Movie list ------------------------------------ 109 | 110 | .movie-list div { 111 | margin-left: 5px; 112 | } 113 | 114 | .card { 115 | width: 150px; 116 | padding: 0.75rem; 117 | margin-bottom: 0rem; 118 | margin-right: 2rem; 119 | border: 0; 120 | background: none; 121 | color: white; 122 | 123 | } 124 | 125 | .card .card-block{ 126 | padding: 15px 0; 127 | width: 100%; 128 | } 129 | 130 | .card .card-text{ 131 | margin-bottom: 0.2rem; 132 | font-size: 12px; 133 | } 134 | 135 | .card .card-text, .card .card-title{ 136 | white-space: nowrap; 137 | overflow: hidden; 138 | text-overflow: ellipsis; 139 | } 140 | 141 | .card-top { 142 | img { 143 | width: 150px; 144 | height: 200px; 145 | cursor: pointer; 146 | &:hover, &:focus { 147 | outline: 2px solid #fff; 148 | opacity: 0.3; 149 | background: $body-bg; 150 | } 151 | } 152 | .show-back { 153 | visibility: hidden; 154 | position: absolute; 155 | top: 25%; 156 | left: 46%; 157 | cursor: pointer; 158 | pointer-events: none; 159 | color: #fff; 160 | font-size: 2rem; 161 | } 162 | &:hover { 163 | .show-back { 164 | visibility: visible; 165 | } 166 | } 167 | 168 | } 169 | 170 | // --------------------------- Curated list ------------------------------------ 171 | .curated-list h3{ 172 | color: rgba(255, 255, 255, 0.69); 173 | } 174 | 175 | // --------------------------- Movie details ------------------------------------ 176 | 177 | .movie { 178 | color: #fff; 179 | margin-top: 54px; 180 | overflow-y: auto; 181 | overflow-x: hidden; 182 | height: calc(100vh - 54px); 183 | background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.11), rgba(0, 0, 0, 0.72), black), url('../images/background.jpg'); 184 | background-size: cover; 185 | } 186 | 187 | .show-header { 188 | padding: 15px; 189 | &.has-trailer { 190 | margin: -75px -50px 50px -50px; 191 | } 192 | #show-name { 193 | padding-top: 15px; 194 | h1 { 195 | font-weight: bolder; 196 | } 197 | } 198 | #show-trailer { 199 | position: relative; 200 | width: 480px; 201 | display: flex; 202 | margin: 0 auto; 203 | cursor: pointer; 204 | i { 205 | position: absolute; 206 | left: 44%; 207 | top: 35%; 208 | font-size: 5rem; 209 | z-index: 10; 210 | } 211 | &:hover { 212 | i { 213 | visibility: visible !important; 214 | } 215 | img{ 216 | opacity: 0.8; 217 | } 218 | } 219 | } 220 | } 221 | 222 | .movie-body { 223 | padding: 25px; 224 | .movie-left-section { 225 | img { 226 | border-radius: 5px; 227 | width: 250px; 228 | } 229 | } 230 | 231 | .movie-center-section { 232 | padding: 0 25px; 233 | .movie-description { 234 | max-height: 15rem; 235 | overflow-y: auto; 236 | } 237 | } 238 | 239 | .movie-right-section h3{ 240 | border-bottom: 1px solid #ccc; 241 | } 242 | 243 | .movie-torrents-section { 244 | height: 10rem; 245 | overflow-y: auto; 246 | overflow-x: hidden; 247 | li { 248 | list-style-type: none; 249 | line-height: 34px; 250 | img { 251 | width: 15px; 252 | } 253 | } 254 | 255 | a { 256 | color: #fff; 257 | } 258 | 259 | .season-title { 260 | font-size: 1.5rem; 261 | } 262 | 263 | .season-episodes { 264 | li { 265 | display: inline-flex; 266 | margin-right: 15px; 267 | } 268 | } 269 | } 270 | } 271 | 272 | 273 | // --------------------------- Player ---------------------------------------/ 274 | 275 | .vjs_video_3-dimensions, .video-js { 276 | width: 100vw; 277 | height: 100vh; 278 | } 279 | 280 | #toggle-me { 281 | background: #000; 282 | position: absolute; 283 | padding-top: 15px; 284 | left: 15px; 285 | right: 15px; 286 | z-index: 1; 287 | color: white; 288 | } 289 | -------------------------------------------------------------------------------- /app/components/App/App.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 46 | -------------------------------------------------------------------------------- /app/components/App/AppBar.vue: -------------------------------------------------------------------------------- 1 | 52 | 53 | 122 | -------------------------------------------------------------------------------- /app/components/App/Error.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /app/components/App/Infos.vue: -------------------------------------------------------------------------------- 1 | 47 | 48 | 54 | -------------------------------------------------------------------------------- /app/components/App/SideNav.vue: -------------------------------------------------------------------------------- 1 | 33 | 34 | 43 | -------------------------------------------------------------------------------- /app/components/App/draft.vue: -------------------------------------------------------------------------------- 1 | 52 | 53 | 121 | -------------------------------------------------------------------------------- /app/components/Player/Player.vue: -------------------------------------------------------------------------------- 1 | 33 | 34 | 183 | -------------------------------------------------------------------------------- /app/components/Show/Season.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 37 | -------------------------------------------------------------------------------- /app/components/Show/ShowDetails.vue: -------------------------------------------------------------------------------- 1 | 102 | 103 | 151 | -------------------------------------------------------------------------------- /app/components/Show/ShowItem.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 48 | -------------------------------------------------------------------------------- /app/components/Show/ShowList.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 111 | -------------------------------------------------------------------------------- /app/components/Show/Torrent.vue: -------------------------------------------------------------------------------- 1 | 33 | 34 | 52 | -------------------------------------------------------------------------------- /app/components/Show/curated/CuratedListItem.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 29 | -------------------------------------------------------------------------------- /app/components/Show/curated/CuratedListList.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 38 | -------------------------------------------------------------------------------- /app/i18n/locales.js: -------------------------------------------------------------------------------- 1 | let locales = { 2 | en: { 3 | navigation: { 4 | movies: 'shows', 5 | tv: 'TV', 6 | curated: 'Curated Lists' 7 | }, 8 | shows: { 9 | popular: 'Popular', 10 | latest: 'Latest', 11 | top_rated: 'Top rated', 12 | random: 'Random', 13 | search_movie: 'Movie Title, Actor Names, ImDB code', 14 | search_serie: 'TV Title, Actor Names, ImDB code', 15 | empty: 'Nothing found :(', 16 | watch: 'Watch', 17 | details: 'Details', 18 | rating: 'Score IMDB', 19 | runtime: 'Runtime', 20 | country: 'Country', 21 | actors: 'Actors', 22 | director: 'Director', 23 | release_date: 'Release Date', 24 | genres: { 25 | all: 'All', 26 | action: 'Action', 27 | adventure: 'Adventure', 28 | animation: 'Animation', 29 | biography: 'Biography', 30 | comedy: 'Comedy', 31 | crime: 'Crime', 32 | documentary: 'Documentary', 33 | drama: 'Drama', 34 | family: 'Family', 35 | fantasy: 'Fantasy', 36 | filmnoir: 'Film-Noir', 37 | history: 'History', 38 | horror: 'Horror', 39 | music: 'Music', 40 | musical: 'Musical', 41 | mystery: 'Mystery', 42 | romance: 'Romance', 43 | scienfiction: 'Sci-Fi', 44 | sport: 'Sport', 45 | thriller: 'Thriller', 46 | war: 'War', 47 | western: 'Western' 48 | } 49 | } 50 | }, 51 | fr: { 52 | navigation: { 53 | movies: 'Films', 54 | tv: 'Séries TV', 55 | curated: 'Sélection' 56 | }, 57 | shows: { 58 | popular: 'Populaires', 59 | latest: 'Nouveautés', 60 | top_rated: 'Meilleurs', 61 | random: 'Aléatoire', 62 | search_movie: 'Nom du film/acteurs, code Imdb', 63 | search_serie: 'Nom de la série/acteur, code Imdb', 64 | empty: '0 résultat de recherche', 65 | watch: 'Regarder', 66 | details: 'Détails', 67 | rating: 'Note IMDB', 68 | runtime: 'Runtime', 69 | country: 'Pays', 70 | actors: 'Acteurs', 71 | director: 'Directeur', 72 | release_date: 'Date de sortie', 73 | genres: { 74 | all: 'Tous', 75 | action: 'Action', 76 | adventure: 'Aventure', 77 | animation: 'Animation', 78 | biography: 'Biographie', 79 | comedy: 'Comédie', 80 | crime: 'Crime', 81 | documentary: 'Documentaire', 82 | drama: 'Drame', 83 | family: 'Famille', 84 | fantasy: 'Fantaisie', 85 | filmnoir: 'Film-Noir', 86 | history: 'Histoire', 87 | horror: 'Horreur', 88 | music: 'Musique', 89 | musical: 'Musical', 90 | mystery: 'Mystère', 91 | romance: 'Romantique', 92 | scienfiction: 'Sci-Fi', 93 | sport: 'Sport', 94 | thriller: 'Thriller', 95 | war: 'Guerre', 96 | western: 'Western' 97 | } 98 | } 99 | }, 100 | nl: { 101 | navigation: { 102 | movies: 'films', 103 | tv: 'TV', 104 | curated: 'Aanbevolen' 105 | }, 106 | shows: { 107 | popular: 'Populair', 108 | latest: 'Nieuwste', 109 | top_rated: 'Top beoordeeld', 110 | random: 'Willekeurig', 111 | search_movie: 'Titel, naam van acteur/actrice, IMDB-code', 112 | search_serie: 'Titel, naam van acteur/actrice, IMDB-code', 113 | empty: 'Niets gevonden', 114 | watch: 'Kijken', 115 | details: 'Details', 116 | rating: 'IMDB-score', 117 | runtime: 'Duur', 118 | country: 'Land', 119 | actors: 'Acteurs', 120 | director: 'Regisseur', 121 | release_date: 'Datum van verschijning', 122 | genres: { 123 | all: 'Alles', 124 | action: 'Actie', 125 | adventure: 'Avontuur', 126 | animation: 'Animatie', 127 | biography: 'Biografie', 128 | comedy: 'Komedie', 129 | crime: 'Crime', 130 | documentary: 'Documentaire', 131 | drama: 'Drama', 132 | family: 'Familie', 133 | fantasy: 'Fantasy', 134 | filmnoir: 'Film noir', 135 | history: 'Historie', 136 | horror: 'Horror', 137 | music: 'Muziek', 138 | musical: 'Musical', 139 | mystery: 'Mystery', 140 | romance: 'Romantiek', 141 | scienfiction: 'Science-fiction', 142 | sport: 'Sport', 143 | thriller: 'Thriller', 144 | war: 'Oorlog', 145 | western: 'Western' 146 | } 147 | } 148 | } 149 | } 150 | 151 | export default locales 152 | -------------------------------------------------------------------------------- /app/i18n/nokat.js: -------------------------------------------------------------------------------- 1 | let nokat = [ 2 | 'zid lawej', 3 | 'chay mefema', 4 | 'idha skerti rawhi', 5 | 'bel anglais', 6 | 'kalamni taw nzidouh', 7 | 'lawejt 9ad manajam' 8 | ] 9 | 10 | export default nokat 11 | -------------------------------------------------------------------------------- /app/index.js: -------------------------------------------------------------------------------- 1 | // Vendor dependencies 2 | require('bootstrap/dist/js/bootstrap.js') 3 | 4 | require('./assets/stylesheets/main.scss') 5 | 6 | var Vue = require('vue') 7 | var VueResource = require('vue-resource') 8 | var VueRouter = require('vue-router') 9 | var VueI18n = require('vue-i18n') 10 | 11 | import App from './components/App/App.vue' 12 | import ShowList from './components/Show/ShowList.vue' 13 | import ShowDetails from './components/Show/ShowDetails.vue' 14 | // import CuratedList from './components/shows/curated/CuratedListList.vue' 15 | import Player from './components/Player/Player.vue' 16 | import locales from './i18n/locales.js' 17 | import strings from './utils/strings.js' 18 | 19 | Vue.use(VueResource) 20 | Vue.use(VueRouter) 21 | Vue.use(VueI18n) 22 | 23 | var router = new VueRouter() 24 | 25 | router.map({ 26 | '/shows/:type': { 27 | name: 'showList', 28 | component: ShowList, 29 | }, 30 | 'shows/:type/:id': { 31 | name: 'showDetails', 32 | component: ShowDetails, 33 | }, 34 | // '/curatedList': { 35 | // name: 'curatedList', 36 | // component: CuratedList 37 | // }, 38 | 'player/:type/:id/:hash': { 39 | name: 'player', 40 | component: Player, 41 | } 42 | }) 43 | 44 | router.redirect({ 45 | '*': '/shows/movies' 46 | }) 47 | 48 | router.start(App, '#app') 49 | 50 | if(navigator.language.indexOf('fr') > - 1) { 51 | Vue.config.lang = 'fr' 52 | }else if (navigator.language.indexOf('nl') > - 1) { 53 | Vue.config.lang = 'nl' 54 | }else { 55 | Vue.config.lang = 'en' 56 | } 57 | 58 | Object.keys(locales).forEach(function (lang) { 59 | Vue.locale(lang, locales[lang]) 60 | }) 61 | -------------------------------------------------------------------------------- /app/services/engine.js: -------------------------------------------------------------------------------- 1 | const WebTorrent = require('webtorrent') 2 | 3 | let _initCalled = false 4 | let engine 5 | let _torrents = {} 6 | let server 7 | 8 | export default class Engine { 9 | constructor() { 10 | if(_initCalled) 11 | return 12 | 13 | _initCalled = true 14 | engine = new WebTorrent() 15 | } 16 | 17 | // Add torrent to engine, return movie file in callback 18 | addMagnet(magnetUri, cb) { 19 | engine.add(magnetUri, function (torrent) { 20 | console.log('new torrent added to engine', torrent.infoHash) 21 | 22 | server = torrent.createServer() 23 | server.listen('25111') 24 | 25 | let movieFile 26 | let mediaIndex = 0 27 | torrent.files.forEach(function (f, index) { 28 | f.select() 29 | 30 | if (/\.(mp4|mkv)$/i.test(f.name)) { 31 | if(!movieFile || f.length > movieFile.length){ 32 | movieFile = f 33 | mediaIndex = index 34 | } 35 | } 36 | }) 37 | 38 | let mediaType = movieFile.name.indexOf('mkv') > -1 ? 'mkv' : 'mp4' 39 | cb(torrent, mediaIndex, mediaType) 40 | }) 41 | } 42 | 43 | destroyServer() { 44 | server.close() 45 | } 46 | 47 | getTorrents() { 48 | const array = [] 49 | 50 | for (const id in _torrents) 51 | array.push(_torrents[id]) 52 | 53 | return array 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /app/services/parse.js: -------------------------------------------------------------------------------- 1 | import Parse from 'parse/node' 2 | import _ from 'underscore' 3 | import google from 'googleapis' 4 | 5 | Parse.initialize('88c22318aaeda928f5a9748884203f6b6c1a6d46'); 6 | Parse.serverURL = 'http://149.202.45.9/parse/streaming' 7 | 8 | export default class DataService { 9 | 10 | // options are sort, skip and query 11 | getShowsFromParse (options) { 12 | var Show = Parse.Object.extend(options.type); 13 | 14 | console.log(options) 15 | 16 | if(options.searchQuery && options.searchQuery.length > 0) { 17 | var queryEqualName = new Parse.Query(Show) 18 | queryEqualName.contains('nameLowCase', (options.searchQuery).toLowerCase()) 19 | 20 | var queryContainActors = new Parse.Query(Show) 21 | queryContainActors.contains('actors', options.searchQuery) 22 | 23 | var queryEqualID = new Parse.Query(Show) 24 | queryEqualID.equalTo('imdbID', options.searchQuery) 25 | 26 | mainQuery = Parse.Query.or(queryEqualName, queryContainActors, queryEqualID) 27 | mainQuery = this.buildQuery(mainQuery, options) 28 | 29 | return mainQuery.find().then(function(results) { 30 | return results 31 | }); 32 | } else { 33 | var mainQuery = new Parse.Query(Show) 34 | mainQuery = this.buildQuery(mainQuery, options) 35 | 36 | return mainQuery.find().then(function(results) { 37 | return results 38 | }); 39 | } 40 | } 41 | 42 | buildQuery(query, options) { 43 | if(options.sort == 'latest') { 44 | query.descending('released') 45 | query.greaterThan('imdbVotes', 100) 46 | } 47 | 48 | if(options.sort == 'popular') { 49 | query.descending('released') 50 | query.greaterThan('imdbRating', 7) 51 | } 52 | 53 | if(options.sort == 'imdbRating') { 54 | query.descending('imdbRating') 55 | } 56 | 57 | if(options.filter !== '') { 58 | query.contains('genre', (options.filter).capitalizeFirstLetter()) 59 | } 60 | 61 | query.limit(options.show) 62 | query.skip(options.skip) 63 | query.exists('plot') 64 | query.notEqualTo('poster', 'N/A') 65 | 66 | return query 67 | } 68 | 69 | getTVEpisodesFromParse(id) { 70 | var tv = new Parse.Object('TV'); 71 | tv.id = id; 72 | 73 | var TVEpisode = Parse.Object.extend('TVEpisode') 74 | var query = new Parse.Query(TVEpisode) 75 | query.equalTo('parent', tv) 76 | query.descending('name') 77 | 78 | return query.find().then(function(results) { 79 | var groups = _.groupBy(results, function(r) { 80 | return r.get('season') 81 | }); 82 | return groups 83 | }) 84 | } 85 | 86 | getShowFromParse(id, type) { 87 | const self = this 88 | var Show = Parse.Object.extend(type) 89 | var query = new Parse.Query(Show) 90 | query.include('parent') 91 | 92 | return query.get(id).then((result) => { 93 | return result 94 | }) 95 | } 96 | 97 | getTrailerFromYoutube(query, cb) { 98 | let youtube = google.youtube({ 99 | version: 'v3', 100 | auth: 'AIzaSyArYwv1MWaj550MwKSbSju8BW4dLAKWsNk' 101 | }); 102 | 103 | query = query.toLowerCase() 104 | 105 | youtube.search.list({ 106 | part: 'id,snippet', 107 | q: `${query} trailer`, 108 | videoCategoryId: '1', 109 | type: 'video', 110 | order: 'viewCount' 111 | }, function (err, data) { 112 | if (!err && data) { 113 | let index, i = 0 114 | while(!index && i < data.items.length) { 115 | let title = (data.items[i].snippet.title).toLowerCase() 116 | if(title.indexOf(query) > -1 && title.indexOf('trailer') > -1) { 117 | index = i 118 | } 119 | 120 | i++ 121 | } 122 | 123 | if(index) { 124 | let item = data.items[index] 125 | let trailer = { 126 | videoURL: `http://www.youtube.com/embed/${item.id.videoId}`, 127 | thumbURL: item.snippet.thumbnails['high'].url 128 | } 129 | 130 | cb(trailer) 131 | } else { 132 | cb({ 133 | videoURL: null, 134 | thumbURL: null 135 | }) 136 | } 137 | 138 | 139 | } 140 | }); 141 | 142 | 143 | } 144 | 145 | getCuratedListFromParse() { 146 | var CuratedList = Parse.Object.extend('CuratedList') 147 | var query = new Parse.Query(CuratedList) 148 | query.include("movies") 149 | 150 | return query.find().then(function(results) { 151 | return results 152 | }); 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /app/services/subs.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const http = require('http') 3 | const fs = require('fs') 4 | const srt2vtt = require('srt2vtt') 5 | const OS = require('opensubtitles-api') 6 | const iconv = require('iconv-lite') 7 | import DataService from './parse' 8 | 9 | export default class Subtitles { 10 | constructor() { 11 | } 12 | 13 | getSubtitles(imdbid, options) { 14 | let self = this 15 | let OpenSubtitles = new OS({ 16 | useragent: 'streamer', 17 | ssl: true 18 | }) 19 | 20 | var query = { 21 | imdbid: imdbid, 22 | sublanguageid: 'eng, fre', 23 | extensions: ['srt', 'vtt'] 24 | } 25 | 26 | if(options.season && options.episode) { 27 | query.season = options.season 28 | query.episode = options.episode 29 | } 30 | 31 | return OpenSubtitles.search(query).then(function (subtitles) { 32 | console.log('Subs engine got', subtitles) 33 | return subtitles 34 | }) 35 | } 36 | 37 | saveSubData(sub, dir, cb) { 38 | let self = this 39 | 40 | http.get(sub.url, function(res) { 41 | console.log(res) 42 | res.pipe(iconv.decodeStream('win1252')).collect(function(err, decodedBody) { 43 | srt2vtt(decodedBody, function(err, vttData) { 44 | if (err) throw new Error(err) 45 | 46 | let filename = 'sub-' + sub.lang + '.vtt' 47 | let vttPath = path.join(dir, filename) 48 | fs.writeFileSync(vttPath, vttData) 49 | cb(vttPath) 50 | }) 51 | }); 52 | }); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/store/store.js: -------------------------------------------------------------------------------- 1 | var store = { 2 | state: { 3 | show: 30, 4 | skip: 0, 5 | filter: '', 6 | sort: 'popular', 7 | searchQuery: '', 8 | type: 'Movie' 9 | }, 10 | loadMore: function () { 11 | this.state.skip = this.state.show + this.state.skip 12 | }, 13 | resetLoad: function () { 14 | this.state.skip = 0 15 | }, 16 | setFilter: function (filter) { 17 | this.state.filter = filter 18 | }, 19 | setSort: function (sort) { 20 | this.state.sort = sort 21 | }, 22 | setSearchQuery: function (searchQuery) { 23 | this.state.searchQuery = searchQuery 24 | }, 25 | setType: function (type) { 26 | this.state.type = type 27 | } 28 | } 29 | 30 | export default store 31 | -------------------------------------------------------------------------------- /app/utils/escapeActions.js: -------------------------------------------------------------------------------- 1 | 2 | export default function escapePopover() { 3 | $('#main-content').click(function(){ 4 | console.log('click') 5 | }) 6 | } 7 | -------------------------------------------------------------------------------- /app/utils/strings.js: -------------------------------------------------------------------------------- 1 | 2 | String.prototype.capitalizeFirstLetter = function() { 3 | return this.charAt(0).toUpperCase() + this.slice(1); 4 | } 5 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoufa88/lawd-desktop/114e6b4daaec86f6f0c2de13e95184214ad74562/logo.png -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const electron = require('electron'); 4 | // Module to control application life. 5 | const app = electron.app; 6 | // Module for communication 7 | const ipcMain = electron.ipcMain; 8 | // Module to create native browser window. 9 | const BrowserWindow = electron.BrowserWindow; 10 | 11 | // Keep a global reference of the window object, if you don't, the window will 12 | // be closed automatically when the JavaScript object is garbage collected. 13 | let mainWindow; 14 | let session; 15 | 16 | function createWindow() { 17 | // Create the browser window. 18 | mainWindow = new BrowserWindow({ width: 1024, height: 800 }); 19 | 20 | // Load the index.html of the app. 21 | // Most examples use __dirname instead of process.cwd(). 22 | // However Webpack, at least by default, injects "" as 23 | // the __dirname parameter in the bundled file. So to keep 24 | // things working both in regular electron usage AND webpack, 25 | // we have to go with process.cwd() instead of __dirname. 26 | mainWindow.loadURL(`file://${__dirname}/app/app.html`); 27 | 28 | // Open the DevTools. 29 | if(process.env.NODE_ENV == 'development') { 30 | mainWindow.webContents.openDevTools(); 31 | } 32 | 33 | // Emitted when the window is closed. 34 | mainWindow.on('closed', function () { 35 | // Dereference the window object, usually you would store windows 36 | // in an array if your app supports multi windows, this is the time 37 | // when you should delete the corresponding element. 38 | mainWindow = null; 39 | }); 40 | } 41 | 42 | // This method will be called when Electron has finished 43 | // initialization and is ready to create browser windows. 44 | app.on('ready', createWindow); 45 | 46 | // Quit when all windows are closed. 47 | app.on('window-all-closed', function () { 48 | // On OS X it is common for applications and their menu bar 49 | // to stay active until the user quits explicitly with Cmd + Q 50 | if (process.platform !== 'darwin') { 51 | app.quit(); 52 | } 53 | }); 54 | 55 | app.on('activate', function () { 56 | // On OS X it's common to re-create a window in the app when the 57 | // dock icon is clicked and there are no other windows open. 58 | if (mainWindow === null) { 59 | createWindow(); 60 | } 61 | }); 62 | -------------------------------------------------------------------------------- /package.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const os = require('os'); 4 | const webpack = require('webpack'); 5 | const cfg = require('./webpack.config.production.js'); 6 | const packager = require('electron-packager'); 7 | const del = require('del'); 8 | const exec = require('child_process').exec; 9 | const argv = require('minimist')(process.argv.slice(2)); 10 | const pkg = require('./package.json'); 11 | const devDeps = Object.keys(pkg.devDependencies); 12 | 13 | const appName = argv.name || argv.n || pkg.productName; 14 | const shouldUseAsar = argv.asar || argv.a || false; 15 | const shouldBuildAll = argv.all || false; 16 | 17 | 18 | const DEFAULT_OPTS = { 19 | dir: './', 20 | name: appName, 21 | asar: shouldUseAsar, 22 | ignore: [ 23 | '/test($|/)', 24 | '/tools($|/)', 25 | '/release($|/)' 26 | ].concat(devDeps.map(name => `/node_modules/${name}($|/)`)) 27 | }; 28 | 29 | const icon = argv.icon || argv.i || 'app/app'; 30 | 31 | if (icon) { 32 | DEFAULT_OPTS.icon = icon; 33 | } 34 | 35 | const version = argv.version || argv.v; 36 | 37 | if (version) { 38 | DEFAULT_OPTS.version = version; 39 | startPack(); 40 | } else { 41 | // use the same version as the currently-installed electron-prebuilt 42 | exec('npm list electron-prebuilt', (err, stdout) => { 43 | if (err) { 44 | DEFAULT_OPTS.version = '1.2.2'; 45 | } else { 46 | DEFAULT_OPTS.version = stdout.split('electron-prebuilt@')[1].replace(/\s/g, ''); 47 | } 48 | 49 | startPack(); 50 | }); 51 | } 52 | 53 | 54 | function startPack() { 55 | console.log('start pack...'); 56 | webpack(cfg, (err, stats) => { 57 | if (err) return console.error(err); 58 | del('release') 59 | .then(paths => { 60 | if (shouldBuildAll) { 61 | // build for all platforms 62 | const archs = ['ia32', 'x64']; 63 | const platforms = ['linux', 'win32', 'darwin']; 64 | 65 | platforms.forEach(plat => { 66 | archs.forEach(arch => { 67 | pack(plat, arch, log(plat, arch)); 68 | }); 69 | }); 70 | } else { 71 | // build for current platform only 72 | pack(os.platform(), os.arch(), log(os.platform(), os.arch())); 73 | } 74 | }) 75 | .catch(err => { 76 | console.error(err); 77 | }); 78 | }); 79 | } 80 | 81 | function pack(plat, arch, cb) { 82 | // there is no darwin ia32 electron 83 | if (plat === 'darwin' && arch === 'ia32') return; 84 | 85 | const iconObj = { 86 | icon: DEFAULT_OPTS.icon + (() => { 87 | let extension = '.png'; 88 | if (plat === 'darwin') { 89 | extension = '.icns'; 90 | } else if (plat === 'win32') { 91 | extension = '.ico'; 92 | } 93 | return extension; 94 | })() 95 | }; 96 | 97 | const opts = Object.assign({}, DEFAULT_OPTS, iconObj, { 98 | platform: plat, 99 | arch, 100 | prune: true, 101 | 'app-version': pkg.version || DEFAULT_OPTS.version, 102 | out: `release/${plat}-${arch}` 103 | }); 104 | 105 | packager(opts, cb); 106 | } 107 | 108 | 109 | function log(plat, arch) { 110 | return (err, filepath) => { 111 | if (err) return console.error(err); 112 | console.log(`${plat}-${arch} finished!`); 113 | }; 114 | } 115 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lawd", 3 | "version": "0.4.0", 4 | "description": "Video streaming desktop application", 5 | "main": "main.js", 6 | "scripts": { 7 | "hot-server": "node server.js", 8 | "build": "cross-env NODE_ENV=production webpack --config webpack.config.production.js --progress --profile --colors", 9 | "start": "cross-env NODE_ENV=production electron ./", 10 | "start-hot": "cross-env HOT=1 NODE_ENV=development electron ./", 11 | "package": "cross-env NODE_ENV=production node package.js --asar", 12 | "package-all": "npm run package -- --all", 13 | "postinstall": "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json", 14 | "dev": "concurrently --kill-others \"npm run hot-server\" \"npm run start-hot\"" 15 | }, 16 | "bin": { 17 | "electron": "./node_modules/.bin/electron" 18 | }, 19 | "dependencies": { 20 | "animate.css": "^3.5.1", 21 | "bootstrap": "^4.0.0-alpha.2", 22 | "filesize": "^3.2.1", 23 | "font-awesome": "^4.6.3", 24 | "googleapis": "^7.1.0", 25 | "iconv-lite": "^0.4.13", 26 | "jquery": "^2.2.2", 27 | "mime": "^1.3.4", 28 | "moment": "^2.13.0", 29 | "opensubtitles-api": "^3.1.1", 30 | "parse": "^1.8.5", 31 | "srt2vtt": "^1.3.1", 32 | "tether": "^1.2.0", 33 | "underscore": "^1.8.3", 34 | "video.js": "^5.10.4", 35 | "vtt.js": "^0.12.1", 36 | "vue": "^1.0.24", 37 | "vue-i18n": "^4.0.0", 38 | "vue-infinite-scroll": "^0.2.3", 39 | "vue-resource": "^0.7.2", 40 | "vue-router": "^0.7.13", 41 | "webtorrent": "^0.94.3", 42 | "ws": "^1.1.0" 43 | }, 44 | "devDependencies": { 45 | "babel-core": "^6.7.2", 46 | "babel-loader": "^6.2.2", 47 | "babel-plugin-transform-runtime": "^6.6.0", 48 | "babel-preset-es2015": "^6.6.0", 49 | "concurrently": "^2.0.0", 50 | "cross-env": "^1.0.7", 51 | "css-loader": "^0.23.1", 52 | "del": "^2.2.0", 53 | "electron-packager": "^7.0.3", 54 | "electron-prebuilt": "^1.2.2", 55 | "electron-rebuild": "^1.1.5", 56 | "express": "^4.13.4", 57 | "extract-text-webpack-plugin": "^1.0.1", 58 | "fbjs-scripts": "^0.7.1", 59 | "file-loader": "^0.8.5", 60 | "fs-jetpack": "^0.9.1", 61 | "json-loader": "^0.5.4", 62 | "minimist": "^1.2.0", 63 | "node-sass": "^3.4.2", 64 | "sass-loader": "^3.2.0", 65 | "style-loader": "^0.13.1", 66 | "url-loader": "^0.5.7", 67 | "vue-hot-reload-api": "^1.3.2", 68 | "vue-html-loader": "1.2.2", 69 | "vue-loader": "^8.2.1", 70 | "vue-style-loader": "^1.0.0", 71 | "webpack": "^1.13.1", 72 | "webpack-dev-middleware": "^1.6.1", 73 | "webpack-hot-middleware": "git+https://github.com/glenjamin/webpack-hot-middleware", 74 | "webpack-target-electron-renderer": "^0.4.0" 75 | }, 76 | "devEngines": { 77 | "node": "4.x || 5.x", 78 | "npm": "2.x || 3.x" 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | 2 | const express = require('express'); 3 | const webpack = require('webpack'); 4 | const config = require('./webpack.config.development'); 5 | 6 | const app = express(); 7 | const compiler = webpack(config); 8 | 9 | const PORT = 3000; 10 | 11 | app.use(require('webpack-dev-middleware')(compiler, { 12 | publicPath: config.output.publicPath, 13 | stats: { 14 | colors: true 15 | } 16 | })); 17 | 18 | app.use(require('webpack-hot-middleware')(compiler)); 19 | 20 | app.listen(PORT, 'localhost', err => { 21 | if (err) { 22 | console.log(err); 23 | return; 24 | } 25 | 26 | console.log(`Listening at http://localhost:${PORT}`); 27 | }); 28 | -------------------------------------------------------------------------------- /webpack.config.base.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | module.exports = { 4 | target: 'electron', 5 | module: { 6 | noParse: [/node_modules\/json-schema\/lib\/validate\.js/, 'ws'], 7 | loaders: [ 8 | { 9 | test: /\.js$/, 10 | exclude: /(node_modules|bower_components)/, 11 | loader: 'babel', 12 | query: { 13 | presets: ['es2015'] 14 | } 15 | }, 16 | { test: /\.json$/, loader: 'json-loader' }, 17 | { test: /\.(jpe|jpg|woff|woff2|eot|ttf|svg)(\?.*$|$)/, loader: 'url-loader?importLoaders=1&limit=100000' }, 18 | { test: /\.vue$/, loader: 'vue' } 19 | ] 20 | }, 21 | output: { 22 | path: path.join(__dirname, 'dist'), 23 | filename: 'bundle.js', 24 | libraryTarget: 'commonjs2' 25 | }, 26 | resolve: { 27 | extensions: ['', '.js'], 28 | root: path.resolve('./node_modules/') 29 | }, 30 | plugins: [ 31 | 32 | ], 33 | externals: [ 34 | 'ws', 35 | 'video.js', 36 | 'googleapis' 37 | // put your node 3rd party libraries which can't be built with webpack here 38 | // (mysql, mongodb, and so on..) 39 | ] 40 | }; 41 | -------------------------------------------------------------------------------- /webpack.config.development.js: -------------------------------------------------------------------------------- 1 | 2 | const webpack = require('webpack'); 3 | const webpackTargetElectronRenderer = require('webpack-target-electron-renderer'); 4 | const baseConfig = require('./webpack.config.base'); 5 | 6 | const config = Object.create(baseConfig); 7 | 8 | config.debug = true; 9 | 10 | config.devtool = 'cheap-module-eval-source-map'; 11 | 12 | config.entry = [ 13 | 'webpack-hot-middleware/client?path=http://localhost:3000/__webpack_hmr', 14 | './app/index' 15 | ]; 16 | 17 | config.output.publicPath = 'http://localhost:3000/dist/'; 18 | 19 | config.module.loaders.push({ 20 | test: /\.global\.css$/, 21 | loaders: [ 22 | 'style-loader', 23 | 'css-loader' 24 | ] 25 | }, { 26 | test: /^((?!\.global).)*\.css$/, 27 | loaders: [ 28 | 'style-loader', 29 | 'css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]' 30 | ] 31 | },{ 32 | test: /\.scss$/, 33 | loaders: [ 34 | 'style', 'css', 'sass' 35 | ] 36 | }); 37 | 38 | config.plugins.push( 39 | new webpack.HotModuleReplacementPlugin(), 40 | new webpack.ProvidePlugin({ 41 | $: "jquery", 42 | jQuery: "jquery", 43 | "window.jQuery": "jquery" 44 | }), 45 | new webpack.ProvidePlugin({ 46 | "window.Tether": "tether", 47 | Tether: "tether" 48 | }), 49 | new webpack.NoErrorsPlugin(), 50 | new webpack.DefinePlugin({ 51 | __DEV__: true, 52 | 'process.env': { 53 | NODE_ENV: JSON.stringify('development') 54 | } 55 | }) 56 | ); 57 | 58 | config.target = webpackTargetElectronRenderer(config); 59 | 60 | module.exports = config; 61 | -------------------------------------------------------------------------------- /webpack.config.production.js: -------------------------------------------------------------------------------- 1 | 2 | const webpack = require('webpack'); 3 | const ExtractTextPlugin = require('extract-text-webpack-plugin'); 4 | const webpackTargetElectronRenderer = require('webpack-target-electron-renderer'); 5 | const baseConfig = require('./webpack.config.base'); 6 | 7 | const config = Object.create(baseConfig); 8 | 9 | config.devtool = 'source-map'; 10 | 11 | config.entry = './app/index'; 12 | 13 | config.output.publicPath = '../dist/'; 14 | 15 | config.module.loaders.push({ 16 | test: /\.global\.scss$/, 17 | loader: ExtractTextPlugin.extract( 18 | 'style-loader', 19 | 'css-loader!sass-loader' 20 | ) 21 | }, { 22 | test: /^((?!\.global).)*\.scss$/, 23 | loader: ExtractTextPlugin.extract( 24 | 'style-loader', 25 | 'css-loader!sass-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]' 26 | ) 27 | }); 28 | 29 | config.plugins.push( 30 | new webpack.optimize.OccurenceOrderPlugin(), 31 | new webpack.DefinePlugin({ 32 | __DEV__: false, 33 | 'process.env': { 34 | NODE_ENV: JSON.stringify('production') 35 | } 36 | }), 37 | new webpack.optimize.UglifyJsPlugin({ 38 | compressor: { 39 | screw_ie8: true, 40 | warnings: false 41 | } 42 | }), 43 | new ExtractTextPlugin('style.css', { allChunks: true }), 44 | new webpack.ProvidePlugin({ 45 | $: "jquery", 46 | jQuery: "jquery" 47 | }), 48 | new webpack.ProvidePlugin({ 49 | "window.Tether": "tether", 50 | Tether: "tether" 51 | }) 52 | ); 53 | 54 | config.target = webpackTargetElectronRenderer(config); 55 | 56 | module.exports = config; 57 | -------------------------------------------------------------------------------- /webpack.node.js: -------------------------------------------------------------------------------- 1 | // for babel-plugin-webpack-loaders 2 | const devConfigs = require('./webpack.config.development'); 3 | 4 | module.exports = { 5 | output: { 6 | libraryTarget: 'commonjs2' 7 | }, 8 | module: { 9 | loaders: devConfigs.module.loaders.slice(1) 10 | } 11 | }; 12 | --------------------------------------------------------------------------------