Compare commits

...

2 Commits

10 changed files with 4186 additions and 11001 deletions

View File

@ -8,7 +8,7 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.4.3/css/foundation.min.css" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.4.3/css/foundation.min.css" />
</head> </head>
<body> <body>
<h2>Admin Page</h2> <h2><a href="/">DumbYT</a> Admin</h2>
<div id="admin_app"></div> <div id="admin_app"></div>
<script src="./../dist/build.js"></script> <script src="./../dist/build.js"></script>
</body> </body>

10969
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -7,20 +7,20 @@
"author": "hak8or", "author": "hak8or",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@types/lodash": "^4.14.104", "@types/lodash": "^4.14.118",
"axios": "^0.18.0", "axios": "^0.18.0",
"css-loader": "^0.28.10", "css-loader": "^1.0.1",
"style-loader": "^0.20.2", "style-loader": "^0.23.1",
"sweetalert2": "^7.13.3", "sweetalert2": "^7.28.2",
"ts-loader": "^4.0.0", "ts-loader": "^5.3.0",
"typescript": "^2.7.2", "typescript": "^2.9.2",
"uglifyjs-webpack-plugin": "^1.2.2", "uglifyjs-webpack-plugin": "^2.0.1",
"vue": "^2.5.13", "vue": "^2.5.17",
"vue-loader": "^14.1.1", "vue-loader": "^15.4.2",
"vue-template-compiler": "^2.5.13", "vue-template-compiler": "^2.5.17",
"webpack": "^4.0.1", "webpack": "^4.25.1",
"webpack-cli": "^2.0.9", "webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.0" "webpack-dev-server": "^3.1.10"
}, },
"scripts": { "scripts": {
"start": "webpack-dev-server --mode development --open", "start": "webpack-dev-server --mode development --open",

View File

@ -14,6 +14,6 @@ This project makes use of the following:
## Getting Started ## Getting Started
1. Clone the repository 1. Clone the repository
2. Run ```npm update``` to download all the project dependencies. 2. Run ```yarn install``` to download all the project dependencies.
3. Run ```npm start``` which will automatically start a server and recompile the typescript based backend when there are file changes. Also, ```/api``` is proxied back to the production server, though this can be edited in ```webpack.config.js```. 3. Run ```yarn start``` which will automatically start a server and recompile the typescript based backend when there are file changes. Also, ```/api``` is proxied back to the production server, though this can be edited in ```webpack.config.js```.
4. Run ```npm run-script build``` which generates the frontend files for production. 4. Run ```yarn build``` which generates the frontend files for production.

View File

@ -6,6 +6,7 @@
<th>Title</th> <th>Title</th>
<th>Description</th> <th>Description</th>
<th>Tags</th> <th>Tags</th>
<th>Delete</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -14,6 +15,7 @@
<td>{{channel.Title}}</td> <td>{{channel.Title}}</td>
<td>{{channel.Description}}</td> <td>{{channel.Description}}</td>
<td>{{channel.User_Tags}}</td> <td>{{channel.User_Tags}}</td>
<td></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<input id="searchbox0" class="searchbox" type="text" v-model="searchbox_str" <input class="searchbox" type="text" v-model="searchbox_str"
placeholder="Search String goes here, for example: >5m,c++" placeholder="Search String goes here, for example: >5m,c++"
/> />
</div> </div>
@ -25,7 +25,7 @@ export default Vue.extend({
searchbox_str (s: string) { searchbox_str (s: string) {
var v = _.debounce((s) => { var v = _.debounce((s) => {
DumbYT.API.search_videos(s).then(videos => { DumbYT.API.search_videos(s).then(videos => {
this.$emit('search_complete', videos) this.$emit('search_complete', s, videos)
}); });
}, 400) }, 400)
v(s); v(s);
@ -40,6 +40,5 @@ export default Vue.extend({
max-width: 40em; max-width: 40em;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
margin-top: 2em;
} }
</style> </style>

View File

@ -58,12 +58,14 @@ export namespace API {
} }
// Search for channels based on a search string. // Search for channels based on a search string.
export async function search_channels(searchstr : string): Promise<Array<Channel>> { export async function search_channels(searchstr : string, highpriority?: boolean): Promise<Array<Channel>> {
// Temporary holder for data. // Temporary holder for data.
let Channels : Array<Channel> = []; let Channels : Array<Channel> = [];
// Ask server for data. // Ask server for data.
let resp = await Axios.get(API.Base_URL + '/Channels/' + searchstr).catch(e => console.log(e)); let resp = await Axios
.get(API.Base_URL + '/Channels/' + searchstr, {params: {High_Priority: highpriority}})
.catch(e => console.log(e));
// Handle all our nulls. // Handle all our nulls.
if (resp == null || resp.data == null) if (resp == null || resp.data == null)
@ -78,12 +80,14 @@ export namespace API {
} }
// Search for videos based on a search string. // Search for videos based on a search string.
export async function search_videos(searchstr : string): Promise<Array<Video>> { export async function search_videos(searchstr : string, highpriority?: boolean): Promise<Array<Video>> {
// Temporary holder for videos. // Temporary holder for videos.
let Videos : Array<Video> = []; let Videos : Array<Video> = [];
// Ask server for videos. // Ask server for videos.
let resp = await Axios.get(API.Base_URL + '/Videos/' + searchstr).catch(e => console.log(e)); let resp = await Axios
.get(API.Base_URL + '/Videos/' + searchstr, {params: {High_Priority: highpriority}})
.catch(e => console.log(e));
// Handle all our nulls. // Handle all our nulls.
if (resp == null || resp.data == null) if (resp == null || resp.data == null)

View File

@ -4,6 +4,7 @@ import SCH from "./components/Search.vue";
import VTBL from "./components/Video_Table.vue"; import VTBL from "./components/Video_Table.vue";
import CTBL from "./components/Channel_Table.vue"; import CTBL from "./components/Channel_Table.vue";
import CADD from "./components/Channel_Add.vue"; import CADD from "./components/Channel_Add.vue";
import VFAVS from "./components/Favorite_Channels.vue";
import './index.css'; import './index.css';
import * as DumbYT from "./dumbyt"; import * as DumbYT from "./dumbyt";
@ -11,26 +12,46 @@ let MainApp = new Vue({
el: "#app", el: "#app",
template: ` template: `
<div> <div>
<VFAVS v-if="VFAVS_Show" v-bind:Videos="Favorite_Videos"/>
<div style="padding-top: 5rem;">
<SCH v-on:search_complete="search_completed"/> <SCH v-on:search_complete="search_completed"/>
<VGC v-bind:Videos="Videos"/> <VGC v-bind:Videos="Videos"/>
</div> </div>
</div>
`, `,
components: { components: {
VFAVS,
SCH, SCH,
VGC VGC
}, },
data() { data() {
return { return {
Videos: Array<DumbYT.Video>() Favorite_Videos: Array<DumbYT.Video>(),
Videos: Array<DumbYT.Video>(),
VFAVS_Show: Boolean()
} }
}, },
methods: { methods: {
// Callback for when the search component got results back. // Callback for when the search component got results back.
search_completed(videos : Array<DumbYT.Video>) : void { search_completed(searchstring: string, videos : Array<DumbYT.Video>) : void {
this.VFAVS_Show = searchstring.length == 0;
this.Videos = videos; this.Videos = videos;
} }
}, },
mounted(){ mounted(){
let v: DumbYT.Video = new DumbYT.Video(null);
v.Title = "Test title";
v.Description = "Test description";
v.Thumbnail = "https://i.ytimg.com/vi/LPxqHXyZhNY/mqdefault.jpg";
v.Channel = "Cool Channel"
this.Favorite_Videos.push(v);
this.Favorite_Videos.push(v);
this.Favorite_Videos.push(v);
this.Favorite_Videos.push(v);
this.Favorite_Videos.push(v);
this.Favorite_Videos.push(v);
this.VFAVS_Show = true;
// Populate some Videos immediatly on start up. // Populate some Videos immediatly on start up.
DumbYT.API.search_videos("").then(videos => { DumbYT.API.search_videos("").then(videos => {
// Copy the videos over. // Copy the videos over.
@ -43,9 +64,13 @@ let AdminApp = new Vue({
el: "#admin_app", el: "#admin_app",
template: ` template: `
<div> <div>
<SCH v-on:search_complete="search_completed"/>
<CADD/> <CADD/>
<CTBL v-bind:Channels="Channels"/> <SCH v-on:search_complete="search_completed"/>
<h3 style="padding-top: 3 rem; padding-left: 3rem;">Channels</h3>
<CTBL ID="Channels_All" v-bind:Channels="Channels"/>
<h3 style="padding-top: 3 rem; padding-left: 3rem;">Videos</h3>
<VTBL v-bind:Videos="Videos"/> <VTBL v-bind:Videos="Videos"/>
</div> </div>
`, `,

View File

@ -1,7 +1,11 @@
var path = require('path') var path = require('path')
var webpack = require('webpack') var webpack = require('webpack')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
module.exports = { module.exports = {
plugins: [
new VueLoaderPlugin()
],
entry: './src/index.ts', entry: './src/index.ts',
output: { output: {
path: path.resolve(__dirname, './dist'), path: path.resolve(__dirname, './dist'),
@ -62,9 +66,13 @@ module.exports = {
historyApiFallback: true, historyApiFallback: true,
proxy: { proxy: {
"/api": { "/api": {
target: "https://dumbyt.hak8or.com", target: "http://localhost:62214",
changeOrigin: true changeOrigin: true
} },
"/hangfire": {
target: "http://localhost:62214",
changeOrigin: true
},
} }
}, },
performance: { performance: {

4116
yarn.lock Normal file

File diff suppressed because it is too large Load Diff