Skip to content

Commit

Permalink
Headless Version - Proof of Concept
Browse files Browse the repository at this point in the history
  • Loading branch information
jaruba committed Jan 25, 2020
1 parent dccc6a9 commit b65b4e9
Show file tree
Hide file tree
Showing 29 changed files with 555 additions and 372 deletions.
524 changes: 265 additions & 259 deletions main.js

Large diffs are not rendered by default.

10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"clean:packages:": "rimraf ./packages",
"lint": "eslint ./src ./tools ./webpackConfig \"./*.js\"",
"start-back": "cross-env NODE_ENV=development electron .",
"start-headless": "node main.js",
"electron-production": "cross-env NODE_ENV=production electron .",
"prepackage": "run-s clean:packages",
"build-back": "electron-packager ./ --out=./packages --icon=./packaging/icons/powder --ignore=\"tools|docs|webpackConfig|lock|public/\"",
Expand All @@ -33,7 +34,6 @@
"decompress-zip": "https://github.com/jaruba/decompress-zip/tarball/master",
"duti-prebuilt": "https://github.com/jaruba/duti-prebuilt/tarball/master",
"easy-ffmpeg": "https://github.com/jaruba/easy-ffmpeg/tarball/master",
"electron-settings": "https://github.com/jaruba/electron-settings/tarball/master",
"formidable": "^1.2.1",
"frisbee": "^1.6.0",
"get-port": "^3.2.0",
Expand All @@ -49,7 +49,7 @@
"node-notifier": "^5.2.1",
"npm-run-all": "^4.1.3",
"opensubtitles-api": "https://github.com/jaruba/opensubtitles-api/tarball/master",
"opn": "^5.3.0",
"open": "^7.0.0",
"parse-torrent": "^6.0.0",
"prop-types": "^15.6.0",
"pump": "^3.0.0",
Expand Down Expand Up @@ -96,9 +96,6 @@
"babel-preset-env": "^1.7.0",
"cross-env": "^5.0.0",
"dotenv": "^4.0.0",
"electron": "^1.6.7",
"electron-devtools-installer": "^2.2.0",
"electron-packager": "^12.1.0",
"eslint-config-react-tools": "^1.0.6",
"eslint-plugin-class-property": "^1.0.6",
"eslint-plugin-import": "^2.7.0",
Expand All @@ -107,9 +104,6 @@
"npm-run-all": "^4.1.3",
"nwb": "^0.19.1"
},
"optionalDependencies": {
"electron-installer-debian": "^0.8.1"
},
"repository": {
"type": "git",
"url": "https://github.com/jaruba/PowderWeb.git"
Expand Down
22 changes: 12 additions & 10 deletions server/acestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,16 +367,18 @@ const connect = async (torrentHash, serverPort, peerflixProxy, reqToken, playlis

let aceVersion

const { app } = require('electron')
const os = require('os')
const TMP = os.tmpDir()
const app = require('./utils/electronShim')

const TMP = app.getPath('temp')

const child = require('child_process')

const exec = child.exec
const spawn = child.spawn

const downloadLoc = path.join(app.getPath('appData'), 'PowderWeb')
const rootDir = app.getPath('appData')

const downloadLoc = app.getPath('userData')

const ace = {
rename: (pid, name) => {
Expand All @@ -401,7 +403,7 @@ const ace = {
let cacheLoc

if (process.platform == 'darwin') {
cacheLoc = path.join(app.getPath("appData"), "PowderWeb", "acestream", "Contents/Resources/wineprefix/drive_c/_acestream_cache_")
cacheLoc = path.join(downloadLoc, "acestream", "Contents/Resources/wineprefix/drive_c/_acestream_cache_")
} else if (process.platform = 'win32') {
cacheLoc = path.join((downloadLoc.split('\\')[0] || 'C:'), '_acestream_cache_')
}
Expand Down Expand Up @@ -462,7 +464,7 @@ const ace = {
let cacheLoc

if (process.platform == 'darwin') {
cacheLoc = path.join(app.getPath("appData"), "PowderWeb", "acestream", "Contents/Resources/wineprefix/drive_c/_acestream_cache_")
cacheLoc = path.join(downloadLoc, "acestream", "Contents/Resources/wineprefix/drive_c/_acestream_cache_")
} else if (process.platform = 'win32') {
cacheLoc = path.join((downloadLoc.split('\\')[0] || 'C:'), '_acestream_cache_')
}
Expand Down Expand Up @@ -522,9 +524,9 @@ const ace = {
const isDirectory = source => fs.lstatSync(source).isDirectory()
const getDirectories = source => fs.readdirSync(source)

getDirectories(app.getPath('appData')).forEach((dirNm) => {
getDirectories(rootDir).forEach((dirNm) => {
if (dirNm.startsWith('com.aceengine.powder'))
portLocs.push(path.join(app.getPath('appData'), dirNm, locOnDrive))
portLocs.push(path.join(rootDir, dirNm, locOnDrive))
})
} else if (process.platform == 'win32') {
portLocs = [path.join(downloadLoc, 'acestream\\engine\\acestream.port')]
Expand Down Expand Up @@ -566,9 +568,9 @@ const ace = {
const isDirectory = source => fs.lstatSync(source).isDirectory()
const getDirectories = source => fs.readdirSync(source)

getDirectories(app.getPath('appData')).forEach((dirNm) => {
getDirectories(rootDir).forEach((dirNm) => {
if (dirNm.startsWith('com.aceengine.powder'))
portLocs.push(path.join(app.getPath('appData'), dirNm, locOnDrive))
portLocs.push(path.join(rootDir, dirNm, locOnDrive))
})
} else if (process.platform == 'win32') {
portLocs = [path.join(downloadLoc, 'acestream\\engine\\acestream.port')]
Expand Down
Loading

2 comments on commit b65b4e9

@vercel
Copy link

@vercel vercel bot commented on b65b4e9 Jan 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaruba
Copy link
Contributor Author

@jaruba jaruba commented on b65b4e9 Jan 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WhitePrime

I'm not sure how you cloned this repository in order for GitHub to send me a notification from the Vercel bot comment..

But I'm sure Powder Web cannot work in a serverless environment, so it won't work on Vercel.

It might work on Heroku, but it's not worth trying as they state torrent use is against their ToS, and have an automatic way of detecting torrent activity so they will remove the deployment pretty fast.

My suggestion, if you want to run it remotely, would be to get a cheap VPS that runs in a country where torrent use is not punished.

Otherwise, if you want to run it locally, a Desktop PC / Intel NUC / NAS would probably be your best bet for a 24/7 home server.

If you want to run it in Docker, there is a discussion about it here and some Dockerfile examples: jaruba/PowderWeb#39

Good luck!

Please sign in to comment.