Add VCinema Vue.js app

This commit is contained in:
Jack Hadrill 2021-01-03 04:56:46 +00:00
parent 33843da80f
commit 0bc1f571d9
15 changed files with 31188 additions and 1 deletions

View File

@ -1,3 +1,26 @@
# VCinema
Web app for VCinema
Web app for VCinema
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

5
babel.config.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

30855
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

54
package.json Normal file
View File

@ -0,0 +1,54 @@
{
"name": "vcinema",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"mitt": "^2.1.0",
"primeflex": "^2.0.0",
"primeicons": "^4.1.0",
"primevue": "^3.1.1",
"vue": "^3.0.0",
"vue-router": "^4.0.2",
"webtorrent": "^0.112.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"@vue/eslint-config-standard": "^5.1.2",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^7.0.0-0"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended",
"@vue/standard"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

17
public/index.html Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

39
src/App.vue Normal file
View File

@ -0,0 +1,39 @@
<template>
<MenuBar :model="items">
</MenuBar>
<router-view />
</template>
<script>
export default {
setup () {
const items = [
{
label: 'Home',
to: '/'
},
{
label: 'Host',
to: '/host'
},
{
label: 'Join',
to: '/join'
}
]
return {
items
}
}
}
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #2c3e50;
}
</style>

BIN
src/assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

35
src/components/Upload.vue Normal file
View File

@ -0,0 +1,35 @@
<template>
<div class="p-card p-component" v-cloak @drop.prevent="droppedFile" @dragover.prevent>
<div class="p-card-body">
<div class="p-card-content">
Hello
</div>
</div>
</div>
</template>
<script>
export default {
setup () {
function droppedFile (e) {
if (e.dataTransfer.files.length !== 1) {
alert('You may only host a single video.')
return
}
const file = e.dataTransfer.files[0]
if (!file.name.endsWith('.mp4') || !file.type === 'video/mp4') {
alert('You may only host an H.264 encoded MP4.')
}
}
return {
droppedFile
}
}
}
</script>
<style>
</style>

36
src/main.js Normal file
View File

@ -0,0 +1,36 @@
import { createApp } from 'vue'
import App from './App.vue'
import Router from './router'
// Import global components.
import Upload from './components/Upload'
// Import PrimeVue dependencies.
import PrimeVue from 'primevue/config'
import Button from 'primevue/button'
import Card from 'primevue/card'
import FileUpload from 'primevue/fileupload'
import InputText from 'primevue/inputtext'
import MenuBar from 'primevue/menubar'
import 'primeflex/primeflex.css'
import 'primeicons/primeicons.css'
import 'primevue/resources/primevue.min.css'
import 'primevue/resources/themes/bootstrap4-light-blue/theme.css'
import WebTorrent from 'webtorrent'
const app = createApp(App)
app.use(Router)
app.use(PrimeVue)
app.use(WebTorrent)
app.component('Button', Button)
app.component('Card', Card)
app.component('FileUpload', FileUpload)
app.component('InputText', InputText)
app.component('MenuBar', MenuBar)
app.component('Upload', Upload)
// Render to DOM.
app.mount('#app')

36
src/router/index.js Normal file
View File

@ -0,0 +1,36 @@
import { createWebHistory, createRouter } from 'vue-router'
import Home from '@/views/Home.vue'
import Host from '@/views/Host.vue'
import Join from '@/views/Join.vue'
import Screen from '@/views/Screen.vue'
const routes = [
{
path: '/',
name: 'Home',
component: Home
},
{
path: '/host',
name: 'Host',
component: Host
},
{
path: '/join',
name: 'Join',
component: Join
},
{
path: '/join/:id',
name: 'Screen',
component: Screen,
props: true
}
]
const router = createRouter({
history: createWebHistory(),
routes
})
export default router

37
src/views/Home.vue Normal file

File diff suppressed because one or more lines are too long

18
src/views/Host.vue Normal file
View File

@ -0,0 +1,18 @@
<template>
<div class="p-p-6">
<h1 class="p-my-0">Host</h1>
<Upload />
</div>
</template>
<script>
export default {
setup () {
}
}
</script>
<style>
</style>

14
src/views/Join.vue Normal file
View File

@ -0,0 +1,14 @@
<template>
<h1>Join</h1>
<InputText />
</template>
<script>
export default {
}
</script>
<style>
</style>

18
src/views/Screen.vue Normal file
View File

@ -0,0 +1,18 @@
<template>
<h1>Screen {{ id }}</h1>
</template>
<script>
export default {
props: {
id: {
required: true,
type: String
}
}
}
</script>
<style>
</style>