mirror of
https://github.com/tedkulp/vidgrab
synced 2026-03-04 13:10:04 -05:00
Fix bookmarklet. Update docs and ports
This commit is contained in:
4
.dockerignore
Normal file
4
.dockerignore
Normal file
@@ -0,0 +1,4 @@
|
||||
dist
|
||||
node_modules
|
||||
downloads
|
||||
.next
|
||||
12
Dockerfile
Normal file
12
Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM node
|
||||
|
||||
COPY package.json package.json
|
||||
COPY package-lock.json package-lock.json
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
CMD [ "npm", "run", "prod" ]
|
||||
19
LICENSE
Normal file
19
LICENSE
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright 2021 Ted Kulp
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
115
README.md
115
README.md
@@ -1,105 +1,36 @@
|
||||
[](https://hub.docker.com/r/tedkulp/vidgrab/)
|
||||
[](https://hub.docker.com/r/tedkulp/vidgrab/)
|
||||
[](https://raw.githubusercontent.com/tedkulp/vidgrab/master/LICENSE)
|
||||
|
||||
# Vidgrab
|
||||
|
||||
# Vidgrab2
|
||||
Simple web interface to download videos with [youtube-dl](https://github.com/ytdl-org/youtube-dl) and store them on your server. Written in Typescript using [nest.js](https://nestjs.com).
|
||||
|
||||
This project was generated using [Nx](https://nx.dev).
|
||||

|
||||
|
||||
<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="450"></p>
|
||||
## Setup
|
||||
|
||||
🔎 **Smart, Extensible Build Framework**
|
||||
Vidgrab was written assuming that Docker would be used to deploy it. It requires redis for it's queuing functionality.
|
||||
|
||||
## Quick Start & Documentation
|
||||
### Docker CLI
|
||||
|
||||
[Nx Documentation](https://nx.dev/angular)
|
||||
```shell
|
||||
docker run -d --name vidgrab -E FILE_DIR=/vidgrab -v /vidgrab:/vidgrab -p 4200:4200 tedkulp/vidgrab
|
||||
```
|
||||
|
||||
[10-minute video showing all Nx features](https://nx.dev/getting-started/intro)
|
||||
### Docker Compose
|
||||
|
||||
[Interactive Tutorial](https://nx.dev/tutorial/01-create-application)
|
||||
There is an example docker-compose.yml file [included](https://raw.githubusercontent.com/tedkulp/vidgrab/master/docker-compose.yml) in the repo. Use that directly to get a site running on port 3000 or modify to taste.
|
||||
|
||||
## Adding capabilities to your workspace
|
||||
### Environment Variables
|
||||
|
||||
Nx supports many plugins which add capabilities for developing different types of applications and different tools.
|
||||
| Name | Default Value | Description |
|
||||
| ---------- | --------------------- | -------------------------------------- |
|
||||
| REDIS_HOST | localhost | Hostname of the redis server |
|
||||
| REDIS_PORT | 6379 | Port to connect to for redis server |
|
||||
| FILE_DIR | /tmp | Directory to store downloads |
|
||||
| SITE_URL | http://localhost:4200 | URL to the site. Used for bookmarklet. |
|
||||
|
||||
These capabilities include generating applications, libraries, etc as well as the devtools to test, and build projects as well.
|
||||
## License
|
||||
|
||||
Below are our core plugins:
|
||||
|
||||
- [Angular](https://angular.io)
|
||||
- `ng add @nrwl/angular`
|
||||
- [React](https://reactjs.org)
|
||||
- `ng add @nrwl/react`
|
||||
- Web (no framework frontends)
|
||||
- `ng add @nrwl/web`
|
||||
- [Nest](https://nestjs.com)
|
||||
- `ng add @nrwl/nest`
|
||||
- [Express](https://expressjs.com)
|
||||
- `ng add @nrwl/express`
|
||||
- [Node](https://nodejs.org)
|
||||
- `ng add @nrwl/node`
|
||||
|
||||
There are also many [community plugins](https://nx.dev/community) you could add.
|
||||
|
||||
## Generate an application
|
||||
|
||||
Run `ng g @nrwl/angular:app my-app` to generate an application.
|
||||
|
||||
> You can use any of the plugins above to generate applications as well.
|
||||
|
||||
When using Nx, you can create multiple applications and libraries in the same workspace.
|
||||
|
||||
## Generate a library
|
||||
|
||||
Run `ng g @nrwl/angular:lib my-lib` to generate a library.
|
||||
|
||||
> You can also use any of the plugins above to generate libraries as well.
|
||||
|
||||
Libraries are shareable across libraries and applications. They can be imported from `@vidgrab2/mylib`.
|
||||
|
||||
## Development server
|
||||
|
||||
Run `ng serve my-app` for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng g component my-component --project=my-app` to generate a new component.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build my-app` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test my-app` to execute the unit tests via [Jest](https://jestjs.io).
|
||||
|
||||
Run `nx affected:test` to execute the unit tests affected by a change.
|
||||
|
||||
## Running end-to-end tests
|
||||
|
||||
Run `ng e2e my-app` to execute the end-to-end tests via [Cypress](https://www.cypress.io).
|
||||
|
||||
Run `nx affected:e2e` to execute the end-to-end tests affected by a change.
|
||||
|
||||
## Understand your workspace
|
||||
|
||||
Run `nx dep-graph` to see a diagram of the dependencies of your projects.
|
||||
|
||||
## Further help
|
||||
|
||||
Visit the [Nx Documentation](https://nx.dev/angular) to learn more.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## ☁ Nx Cloud
|
||||
|
||||
### Distributed Computation Caching & Distributed Task Execution
|
||||
|
||||
<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-cloud-card.png"></p>
|
||||
|
||||
Nx Cloud pairs with Nx in order to enable you to build and test code more rapidly, by up to 10 times. Even teams that are new to Nx can connect to Nx Cloud and start saving time instantly.
|
||||
|
||||
Teams using Nx gain the advantage of building full-stack applications with their preferred framework alongside Nx’s advanced code generation and project dependency graph, plus a unified experience for both frontend and backend developers.
|
||||
|
||||
Visit [Nx Cloud](https://nx.app/) to learn more.
|
||||
This software is available under the [MIT License](https://opensource.org/licenses/MIT).
|
||||
|
||||
@@ -4,4 +4,5 @@ export default () => ({
|
||||
? parseInt(process.env.REDIS_PORT, 10)
|
||||
: 6379,
|
||||
fileDir: process.env.FILE_DIR || '/tmp',
|
||||
siteUrl: process.env.SITE_URL || 'http://localhost:4200',
|
||||
});
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
ValidationPipe,
|
||||
} from '@nestjs/common';
|
||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { Queue } from 'bull';
|
||||
import { pick, trimEnd } from 'lodash';
|
||||
|
||||
@@ -28,18 +29,19 @@ export class WebController {
|
||||
@InjectQueue('vidgrab') private readonly vidgrabQueue: Queue,
|
||||
private readonly ytdlService: YtdlService,
|
||||
private readonly eventEmitter: EventEmitter2,
|
||||
private readonly configService: ConfigService,
|
||||
) {}
|
||||
|
||||
@Get('/info')
|
||||
// @Render('Index')
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async root(@Req() request: any) {
|
||||
const fullUrl =
|
||||
const fullUrl = this.configService.get('siteUrl') ||
|
||||
request.protocol + '://' + request.get('host') + request.originalUrl;
|
||||
const bookmarklet = `javascript:(function(){var xhr=new XMLHttpRequest();xhr.open('POST',encodeURI('${trimEnd(
|
||||
fullUrl,
|
||||
'/',
|
||||
)}/queue'));xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xhr.send('url='+document.location.href.replace(/ /g,'+'));}());`;
|
||||
)}'));xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xhr.send('url='+document.location.href.replace(/ /g,'+'));}());`;
|
||||
|
||||
const jobs = await this.vidgrabQueue.getJobs([
|
||||
'completed',
|
||||
|
||||
19
docker-compose.yml
Normal file
19
docker-compose.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
version: '3'
|
||||
services:
|
||||
redis:
|
||||
image: redis
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 6379:6379
|
||||
vidgrab:
|
||||
# image: tedkulp/vidgrab
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- REDIS_HOST=redis
|
||||
- FILE_DIR=/downloads
|
||||
- SITE_URL=http://localhost:4200
|
||||
ports:
|
||||
- 4200:4200
|
||||
volumes:
|
||||
- ${PWD}/downloads:/downloads
|
||||
Reference in New Issue
Block a user