Compare commits
22 commits
96a6f5c0d2
...
a07edfc842
| Author | SHA1 | Date | |
|---|---|---|---|
| a07edfc842 | |||
| 0dda73cd14 | |||
| d03e221891 | |||
| 058ab2708a | |||
| 3d853a3282 | |||
| 70fc42b181 | |||
| 7530b5fa5f | |||
| 0b7f99725d | |||
| 36ae90b7af | |||
| c5c484b8c1 | |||
| 3ca91288d2 | |||
| ee47e1b844 | |||
| ae294b3f78 | |||
| bbb3576a7d | |||
| ea882bb3c3 | |||
| 9cfe271323 | |||
| c6d2316ebb | |||
| dac9631f60 | |||
| 4dbc5b69cf | |||
| 855343dfc3 | |||
| 8d7d08d5c0 | |||
| a01d94a57e |
258 changed files with 1378 additions and 713 deletions
2
LICENSE
2
LICENSE
|
|
@ -1,4 +1,4 @@
|
|||
All Original Canopy Code is Covered under the Gnu Affero General Public License v3 - 2024 - 2025 Rainbownapkin
|
||||
All Original Canopy Code is Covered under the Gnu Affero General Public License v3 - 2024 - 2026 Rainbownapkin
|
||||
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Canopy
|
|||
<a href="https://git.ourfore.st/rainbownapkin/canopy/issues" target="_blank"><img src="https://git.ourfore.st/rainbownapkin/canopy/badges/issues/closed.svg"></a>
|
||||
<a href="https://www.gnu.org/licenses/agpl-3.0.en.html" target="_blank"><img src="https://img.shields.io/badge/License-AGPL_v3-663366.svg"></a>
|
||||
|
||||
0.1-Alpha (Panama Red) - Hotfix 4
|
||||
0.2-Alpha (Durban Poison)
|
||||
=========
|
||||
|
||||
Canopy - /ˈkæ.nə.pi/:
|
||||
|
|
|
|||
9
contributing.md
Normal file
9
contributing.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
We're a pretty small and informal community, so I think I can make this small and informal:
|
||||
|
||||
- Registration on git.ourfore.st is locked for anti-bot reasons. Bug bowie if you want access.
|
||||
- Start a new branch either here or on another gitforge (preferably https://codeburg.org), and submit a PR
|
||||
- Don't feel the need to limit yourself to already open issues, those are simply my current goals. Feel free to fuck around and make cool shit.
|
||||
- No stolen and/or LLM-Generated code
|
||||
- Thank you and much love for peeking at, using, and maybe even contributing to Canopy! <3
|
||||
|
||||
-Bowie
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "canopy-of-alpha",
|
||||
"version": "0.1.4",
|
||||
"canopyDisplayVersion": "0.1-Alpha (Panama Red) - Hotfix 4",
|
||||
"version": "0.2.0",
|
||||
"canopyDisplayVersion": "0.2-Alpha (Durban Poison)",
|
||||
"license": "AGPL-3.0-only",
|
||||
"dependencies": {
|
||||
"@braintree/sanitize-url": "^7.1.1",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
@ -47,6 +47,11 @@ class activeChannel{
|
|||
*/
|
||||
this.tokeCommands = chanDB.tokeCommands;
|
||||
|
||||
/**
|
||||
* Internal Database Identifier for the channel
|
||||
*/
|
||||
this._id = chanDB._id;
|
||||
|
||||
/**
|
||||
* List of connected users
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
@ -54,6 +54,11 @@ class connectedUser{
|
|||
*/
|
||||
this.highLevel = userDB.highLevel;
|
||||
|
||||
/**
|
||||
* Internal Database Identifier for the user
|
||||
*/
|
||||
this._id = userDB._id;
|
||||
|
||||
//Check to make sure users flair entry from DB is good
|
||||
if(userDB.flair != null){
|
||||
//Set flair from DB
|
||||
|
|
|
|||
135
src/app/channel/media/archivedMedia.js
Normal file
135
src/app/channel/media/archivedMedia.js
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
||||
|
||||
//Local Imports
|
||||
const media = require('./media');
|
||||
const queuedMedia = require('./queuedMedia');
|
||||
|
||||
/**
|
||||
* Class extending media which represents a queued piece of media
|
||||
* @extends media
|
||||
*/
|
||||
class archivedMedia extends queuedMedia{
|
||||
/**
|
||||
* Creates a new queued media object
|
||||
* @param {String} channel - Channel where object was queued
|
||||
*/
|
||||
constructor(title, fileName, url, id, type, duration, rawLink, startTime, startTimeStamp = 0, earlyEnd, uuid, channel){
|
||||
//Call derived constructor
|
||||
super(title, fileName, url, id, type, duration, rawLink, startTime, startTimeStamp, earlyEnd, uuid);
|
||||
|
||||
/**
|
||||
* Channel media was queued
|
||||
*/
|
||||
this.channel = channel;
|
||||
|
||||
/**
|
||||
* Media status type
|
||||
*/
|
||||
this.status = 'archived';
|
||||
}
|
||||
|
||||
//statics
|
||||
/**
|
||||
* Creates a archivedMedia object from a media object
|
||||
* @param {String} channel - Channel where object was queued
|
||||
* @returns {archivedMedia} queuedMedia object created from given media object
|
||||
*/
|
||||
static fromMedia(media, startTime, startTimeStamp, channel){
|
||||
//Create and return queuedMedia object from given media object and arguments
|
||||
return new this(
|
||||
media.title,
|
||||
media.fileName,
|
||||
media.url,
|
||||
media.id,
|
||||
media.type,
|
||||
media.duration,
|
||||
media.rawLink,
|
||||
startTime,
|
||||
startTimeStamp,
|
||||
null,
|
||||
null,
|
||||
channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a archivedMedia object from a queuedMedia object
|
||||
* @param {String} channel - Channel where object was queued
|
||||
* @returns {archivedMedia} queuedMedia object created from given media object
|
||||
*/
|
||||
static fromQueuedMedia(media, channel){
|
||||
//Create and return queuedMedia object from given media object and arguments
|
||||
return new this(
|
||||
media.title,
|
||||
media.fileName,
|
||||
media.url,
|
||||
media.id,
|
||||
media.type,
|
||||
media.duration,
|
||||
media.rawLink,
|
||||
media.startTime,
|
||||
media.startTimeStamp,
|
||||
media.earlyEnd,
|
||||
media.uuid,
|
||||
channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts array of media objects into array of archivedMedia objects
|
||||
* @param {String} channel - Channel where object was queued
|
||||
* @returns Array of converted queued media objects
|
||||
*/
|
||||
static fromMediaArray(mediaList, start, channel){
|
||||
//Queued Media List
|
||||
const archivedMediaList = [];
|
||||
//Start Time Offset
|
||||
let startOffset = 0;
|
||||
|
||||
for(let media of mediaList){
|
||||
//Convert mediaObj to queuedMedia and push to the back of the list
|
||||
archivedMediaList.push(this.fromMedia(media, start + startOffset, 0, channel));
|
||||
|
||||
//Set start offset to end of the current item
|
||||
startOffset += (media.duration * 1000) + 5;
|
||||
}
|
||||
|
||||
return archivedMediaList;
|
||||
}
|
||||
|
||||
//methods
|
||||
/**
|
||||
* Generates a unique clone of a given media object
|
||||
* @returns unique clone of media object
|
||||
*/
|
||||
clone(){
|
||||
return new archivedMedia(
|
||||
this.title,
|
||||
this.fileName,
|
||||
this.url,
|
||||
this.id,
|
||||
this.type,
|
||||
this.duration,
|
||||
this.rawLink,
|
||||
this.startTime,
|
||||
this.startTimeStamp,
|
||||
this.earlyEnd,
|
||||
null,
|
||||
this.channel
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = archivedMedia;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
@ -16,14 +16,18 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
|||
|
||||
//NPM imports
|
||||
const validator = require('validator');
|
||||
const mongoose = require('mongoose');
|
||||
const { BSON } = require('mongodb');
|
||||
|
||||
//Local imports
|
||||
const config = require('../../../../config.json');
|
||||
const queuedMedia = require('./queuedMedia');
|
||||
const archivedMedia = require('./archivedMedia');
|
||||
const yanker = require('../../../utils/media/yanker');
|
||||
const loggerUtils = require('../../../utils/loggerUtils');
|
||||
const channelModel = require('../../../schemas/channel/channelSchema');
|
||||
const permissionModel = require('../../../schemas/permissionSchema');
|
||||
const archivedMediaModel = require('../../../schemas/channel/media/archivedMediaSchema');
|
||||
|
||||
/**
|
||||
* Object represneting a single channel's media queue
|
||||
|
|
@ -422,6 +426,8 @@ class queue{
|
|||
if(data != null && data.full){
|
||||
//Pull the channel DB doc
|
||||
const chanDB = await channelModel.findOne({name:this.channel.name});
|
||||
//Pull archived media by channel name
|
||||
const archived = await this.getArchive();
|
||||
|
||||
//Cook and emit a new object from all of the data
|
||||
socket.emit("dumpQueue", {
|
||||
|
|
@ -432,7 +438,7 @@ class queue{
|
|||
DB: {
|
||||
schedule: chanDB.media.scheduled,
|
||||
nowPlaying: chanDB.media.nowPlaying,
|
||||
archived: chanDB.media.archived,
|
||||
archived,
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -767,31 +773,14 @@ class queue{
|
|||
//Get requested media
|
||||
const media = this.getItemByUUID(uuid);
|
||||
|
||||
//If we got a bad request
|
||||
//If we couldn't find anything in the current channel schedule
|
||||
if(media == null){
|
||||
try{
|
||||
//If we wheren't handed a channel
|
||||
if(chanDB == null){
|
||||
//DO everything ourselves since we don't have a fance end() function to do it
|
||||
chanDB = await channelModel.findOne({name:this.channel.name});
|
||||
}
|
||||
//Attempt to delete matching item from archived media
|
||||
const deletedArchive = await archivedMediaModel.deleteOne({channel: this.channel._id, uuid: new BSON.UUID(uuid)});
|
||||
|
||||
//If we couldn't find the channel
|
||||
if(chanDB == null){
|
||||
//FUCK
|
||||
throw loggerUtils.exceptionSmith(`Unable to find channel document ${this.channel.name} while queue item!`, "queue");
|
||||
}
|
||||
|
||||
//Keep a copy of the archive that hasn't been changed
|
||||
const preArchive = chanDB.media.archived;
|
||||
|
||||
//Filter out the requested item from the archive
|
||||
chanDB.media.archived = chanDB.media.archived.filter((record)=>{
|
||||
return record.uuid.toString() != uuid;
|
||||
})
|
||||
|
||||
//If nothing changed in the archive
|
||||
if(preArchive.length == chanDB.media.archived.length){
|
||||
//if nothing got deleted
|
||||
if(deletedArchive == null || deletedArchive.deletedCount == 0){
|
||||
//If an originating socket was provided for this request
|
||||
if(socket != null){
|
||||
//Yell at the user for being an asshole
|
||||
|
|
@ -802,13 +791,7 @@ class queue{
|
|||
//If broadcasting is enabled
|
||||
if(!noBroadcast){
|
||||
//Broadcast changes
|
||||
this.broadcastQueue(chanDB);
|
||||
}
|
||||
|
||||
//If saving is disabled
|
||||
if(!noScheduling){
|
||||
//Save changes to the DB
|
||||
await chanDB.save();
|
||||
this.broadcastQueue();
|
||||
}
|
||||
}
|
||||
}catch(err){
|
||||
|
|
@ -1145,7 +1128,7 @@ class queue{
|
|||
//If nowPlaying isn't null and isn't what we're about to throw on
|
||||
if(chanDB.media.nowPlaying != null && chanDB.media.nowPlaying.uuid.toString() != mediaObj.uuid){
|
||||
//Archive whats already in there since we're about to clobber the fuck out of it
|
||||
chanDB.media.archived.push(chanDB.media.nowPlaying);
|
||||
this.archiveMedia(chanDB.media.nowPlaying);
|
||||
}
|
||||
|
||||
//Set the now playing queued media document
|
||||
|
|
@ -1284,7 +1267,7 @@ class queue{
|
|||
//If archiving is enabled
|
||||
if(!noArchive){
|
||||
//Add the item to the channel archive
|
||||
chanDB.media.archived.push(wasPlaying);
|
||||
await this.archiveMedia(wasPlaying);
|
||||
}
|
||||
|
||||
//broadcast queue using unsaved archive, run this before chanDB.save() for better responsiveness
|
||||
|
|
@ -1383,7 +1366,7 @@ class queue{
|
|||
let finished = false;
|
||||
|
||||
//Throw the livestream into the archive
|
||||
chanDB.media.archived.push(wasPlaying);
|
||||
this.archiveMedia(wasPlaying);
|
||||
|
||||
//Save the DB
|
||||
await chanDB.save();
|
||||
|
|
@ -1468,7 +1451,7 @@ class queue{
|
|||
}
|
||||
|
||||
//Throw the livestream into the archive
|
||||
chanDB.media.archived.push(wasPlaying);
|
||||
this.archiveMedia(wasPlaying);
|
||||
|
||||
//Set the current place to schedule items at 5ms after the end of the live stream
|
||||
let curPlace = wasPlaying.getEndTime() + 5;
|
||||
|
|
@ -1737,30 +1720,28 @@ class queue{
|
|||
//Create an empty array to hold our schedule
|
||||
let schedule = [];
|
||||
|
||||
//Get yestedays epoch
|
||||
const yesterday = new Date().setDate(new Date().getDate() - 1);
|
||||
//Get todays epoch
|
||||
const yesterday = new Date();
|
||||
|
||||
//Make it yesterdays
|
||||
yesterday.setDate(yesterday.getDate() - 1);
|
||||
|
||||
//Get archive since yesterday
|
||||
const archive = await this.getArchive(yesterday);
|
||||
|
||||
//Iterate through the channel archive backwards to save time
|
||||
for(let mediaIndex = chanDB.media.archived.length - 1; mediaIndex >= 0; mediaIndex--){
|
||||
for(let mediaIndex = archive.length - 1; mediaIndex >= 0; mediaIndex--){
|
||||
//Grab the current media record
|
||||
let media = chanDB.media.archived[mediaIndex].rehydrate();
|
||||
let media = archive[mediaIndex].rehydrate();
|
||||
|
||||
//If the media started within the last 24 hours
|
||||
if(media.startTime > yesterday){
|
||||
//If we're sending out the live remainder during a live stream
|
||||
if(this.liveRemainder != null && media.uuid.toString() == this.liveRemainder.uuid.toString()){
|
||||
//Throw out the early end before sending it off, so it looks like it hasn't been cut off yet (smoke n mirrors :P)
|
||||
media.earlyEnd = null;
|
||||
}
|
||||
|
||||
//Add it to the temporary schedule array as if it where part of the actual schedule map
|
||||
schedule.unshift([media.startTime, media]);
|
||||
//Otherwise if it's older
|
||||
}else{
|
||||
//Then we should be done as archived items are added as they are played/end.
|
||||
//No newer items should be beyond this point!
|
||||
break;
|
||||
//If we're sending out the live remainder during a live stream
|
||||
if(this.liveRemainder != null && media.uuid.toString() == this.liveRemainder.uuid.toString()){
|
||||
//Throw out the early end before sending it off, so it looks like it hasn't been cut off yet (smoke n mirrors :P)
|
||||
media.earlyEnd = null;
|
||||
}
|
||||
|
||||
//Add it to the temporary schedule array as if it where part of the actual schedule map
|
||||
schedule.unshift([media.startTime, media]);
|
||||
}
|
||||
|
||||
//Concatonate the actual schedule to the items we pulled out of the archive return it
|
||||
|
|
@ -1810,7 +1791,7 @@ class queue{
|
|||
chanDB.media.nowPlaying = null;
|
||||
|
||||
//Archive the bitch
|
||||
chanDB.media.archived.push(wasPlaying);
|
||||
this.archiveMedia(wasPlaying);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1840,36 +1821,36 @@ class queue{
|
|||
//If it's been ended
|
||||
}else{
|
||||
//Archive ended media
|
||||
chanDB.media.archived.push(record);
|
||||
this.archiveMedia(record);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//If we have a remainder from a livestream
|
||||
if(chanDB.media.liveRemainder){
|
||||
//Iterate backwards through the archive to pull the newest first, since that's probably where this fucker is
|
||||
for(let archiveIndex = (chanDB.media.archived.length - 1); archiveIndex > 0; archiveIndex--){
|
||||
//Grab the current media object
|
||||
const archivedMedia = chanDB.media.archived[archiveIndex];
|
||||
let archive = await this.getArchive();
|
||||
|
||||
|
||||
//Iterate backwards through channel archive
|
||||
for(let archiveIndex = (archive.length - 1); archiveIndex > 0; archiveIndex--){
|
||||
//If the current object matches our remainder UUID
|
||||
if((archivedMedia.uuid.toString() == chanDB.media.liveRemainder.toString())){
|
||||
if((archive[archiveIndex].uuid.toString() == chanDB.media.liveRemainder.toString())){
|
||||
//Null out any early end
|
||||
archivedMedia.earlyEnd = null;
|
||||
archive[archiveIndex].earlyEnd = null;
|
||||
|
||||
//Re-hydrate the item
|
||||
const archivedMediaObject = archivedMedia.rehydrate();
|
||||
const archivedMediaObject = archive[archiveIndex].rehydrate();
|
||||
|
||||
//if we still have a video to finish
|
||||
if(archivedMediaObject.getEndTime() > now){
|
||||
//Set the fucker as now playing
|
||||
chanDB.media.nowPlaying = archivedMediaObject;
|
||||
//Convert the fucker back to queuedMedia and save as now playing
|
||||
chanDB.media.nowPlaying = queuedMedia.fromArchivedMedia(archivedMediaObject);
|
||||
|
||||
//Schedule the fucker in RAM, w/ the start function also running in RAM-Only mode
|
||||
this.scheduleMedia([archivedMediaObject], null, chanDB, true, true, true);
|
||||
|
||||
//Splice the fucker out of the archive
|
||||
chanDB.media.archived.splice(archiveIndex, 1);
|
||||
await archivedMediaModel.deleteOne({channel: this.channel._id, uuid: new BSON.UUID(chanDB.media.liveRemainder)});
|
||||
}
|
||||
|
||||
//Break out of the loop
|
||||
|
|
@ -1892,6 +1873,36 @@ class queue{
|
|||
loggerUtils.localExceptionHandler(err);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Commits a queuedMedia object to the media archives
|
||||
* @param {queuedMedia} media - Media object to be archived
|
||||
*/
|
||||
async archiveMedia(media){
|
||||
//Convert queuedMedia object to archivedMedia object
|
||||
let archived = archivedMedia.fromQueuedMedia(media, this.channel._id);
|
||||
//Save archivedMedia object to site-wide media archive (gross but performant)
|
||||
let archivedDoc = await archivedMediaModel.create(archived);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Channel Archive
|
||||
*/
|
||||
async getArchive(startDate){
|
||||
//If we provided a start date
|
||||
if(startDate != null){
|
||||
//Return archived media after start date
|
||||
return await archivedMediaModel.find({
|
||||
channel:this.channel._id,
|
||||
//Prevent mongoose from attempting to sanatize and invalidate our query object, plus I think we can trust an epoch that came from server-side :)
|
||||
startTime: mongoose.trusted({$gt: startDate.getTime()})
|
||||
});
|
||||
//Otherwise
|
||||
}else{
|
||||
//return all archived media
|
||||
return await archivedMediaModel.find({channel:this.channel._id});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = queue;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
@ -21,7 +21,7 @@ const loggerUtils = require("../../../utils/loggerUtils");
|
|||
const channelModel = require("../../../schemas/channel/channelSchema");
|
||||
|
||||
/**
|
||||
* Class containg global server-side private message relay logic
|
||||
* Class containg per-channel server-side queue broadcasting logic
|
||||
*
|
||||
* Exists to make broadcasting channel queues to groups of authenticated users with the 'read-queue' perm as painless as possible,
|
||||
* reducing DB call/perm checks to just connection time, and not requireing any out-of-library user iteration at broadcast time.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
@ -88,6 +88,27 @@ class queuedMedia extends media{
|
|||
startTimeStamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a queuedMedia object from an archivedMedia object
|
||||
* @param {String} channel - Channel where object was queued
|
||||
* @returns {archivedMedia} queuedMedia object created from given media object
|
||||
*/
|
||||
static fromArchivedMedia(media){
|
||||
//Create and return queuedMedia object from given media object and arguments
|
||||
return new this(
|
||||
media.title,
|
||||
media.fileName,
|
||||
media.url,
|
||||
media.id,
|
||||
media.type,
|
||||
media.duration,
|
||||
media.rawLink,
|
||||
media.startTime,
|
||||
media.startTimeStamp,
|
||||
media.earlyEnd,
|
||||
media.uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts array of media objects into array of queuedMedia objects
|
||||
* @param {Array} mediaList - Array of media objects to queue
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
@ -30,7 +30,7 @@ const emoteModel = require('../emoteSchema');
|
|||
const channelPermissionSchema = require('./channelPermissionSchema');
|
||||
const channelBanSchema = require('./channelBanSchema');
|
||||
const queuedMediaSchema = require('./media/queuedMediaSchema');
|
||||
const playlistSchema = require('./media/playlistSchema');
|
||||
const {playlistSchema} = require('./media/playlist/playlistSchema');
|
||||
const chatSchema = require('./chatSchema');
|
||||
//Utils
|
||||
const { exceptionHandler, errorHandler } = require('../../utils/loggerUtils');
|
||||
|
|
@ -666,77 +666,6 @@ channelSchema.methods.getEmotes = function(){
|
|||
return emoteList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates Network-Friendly Browser-Digestable list of channel playlists
|
||||
* @returns {Array} Network-Friendly Browser-Digestable list of channel playlists
|
||||
*/
|
||||
channelSchema.methods.getPlaylists = function(){
|
||||
//Create an empty array to hold our emote list
|
||||
const playlists = [];
|
||||
|
||||
//For each channel emote
|
||||
for(let playlist of this.media.playlists){
|
||||
//Push an object with select information from the emote to the emote list
|
||||
playlists.push(playlist.dehydrate());
|
||||
}
|
||||
|
||||
//return the emote list
|
||||
return playlists;
|
||||
}
|
||||
|
||||
/**
|
||||
* Crawls through channel playlists, running a given callback function against each one
|
||||
* @param {Function} cb - Callback function to run against channel playlists
|
||||
*/
|
||||
channelSchema.methods.playlistCrawl = function(cb){
|
||||
for(let listIndex in this.media.playlists){
|
||||
//Grab the associated playlist
|
||||
playlist = this.media.playlists[listIndex];
|
||||
|
||||
//Call the callback with the playlist and list index as arguments
|
||||
cb(playlist, listIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds channel playlist by playlist name
|
||||
* @param {String} name - name of given playlist to find
|
||||
* @returns {Mongoose.Document} - Sub-Document representing a single playlist
|
||||
*/
|
||||
channelSchema.methods.getPlaylistByName = function(name){
|
||||
//Create null value to hold our found playlist
|
||||
let foundPlaylist = null;
|
||||
|
||||
//Crawl through active playlists
|
||||
this.playlistCrawl((playlist, listIndex) => {
|
||||
//If we found a match based on name
|
||||
if(playlist.name == name){
|
||||
//Keep it
|
||||
foundPlaylist = playlist;
|
||||
//Pass down the list index
|
||||
foundPlaylist.listIndex = listIndex;
|
||||
}
|
||||
});
|
||||
|
||||
//return the given playlist
|
||||
return foundPlaylist;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes channel playlist by playlist name
|
||||
* @param {String} name - name of given playlist to Delete
|
||||
*/
|
||||
channelSchema.methods.deletePlaylistByName = async function(name){
|
||||
//Find the playlist
|
||||
let playlist = this.getPlaylistByName(name);
|
||||
|
||||
//splice out the given playlist
|
||||
this.media.playlists.splice(playlist.listIndex, 1);
|
||||
|
||||
//save the channel document
|
||||
await this.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates Network-Friendly Browser-Digestable list of Channel-Wide user bans
|
||||
* @returns {Array} Network-Friendly Browser-Digestable list of Channel-Wide user bans
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
81
src/schemas/channel/media/archivedMediaSchema.js
Normal file
81
src/schemas/channel/media/archivedMediaSchema.js
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
||||
|
||||
//NPM Imports
|
||||
const {mongoose} = require('mongoose');
|
||||
|
||||
//Local Imports
|
||||
const mediaSchema = require('./mediaSchema');
|
||||
const archivedMedia = require('../../../app/channel/media/archivedMedia');
|
||||
|
||||
/**
|
||||
* DB Schema for documents representing a archived media object
|
||||
*/
|
||||
const archivedProperties = new mongoose.Schema({
|
||||
channel: {
|
||||
type: mongoose.SchemaTypes.ObjectID,
|
||||
ref: "channel",
|
||||
required: true
|
||||
},
|
||||
startTime: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
required: true,
|
||||
},
|
||||
startTimeStamp: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
required: false,
|
||||
},
|
||||
earlyEnd: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
required: false,
|
||||
},
|
||||
uuid: {
|
||||
type: mongoose.SchemaTypes.UUID,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
discriminatorKey: 'status'
|
||||
});
|
||||
|
||||
//Methods
|
||||
/**
|
||||
* Rehydrate to a full phat archived media object
|
||||
* @returns {archivedMedia} A full phat archived media object, re-hydrated from the DB
|
||||
*/
|
||||
archivedProperties.methods.rehydrate = function(){
|
||||
return new archivedMedia(
|
||||
this.title,
|
||||
this.fileName,
|
||||
this.url,
|
||||
this.id,
|
||||
this.type,
|
||||
this.duration,
|
||||
//We don't save raw links that are stored seperate from the standard URL as they tend to expire.
|
||||
undefined,
|
||||
this.startTime,
|
||||
this.startTimeStamp,
|
||||
this.earlyEnd,
|
||||
this.uuid.toString(),
|
||||
this.channel
|
||||
);
|
||||
}
|
||||
|
||||
//Create 'archivedMediaSchema' as descriminator of mediaSchema
|
||||
var archivedMediaSchema = mediaSchema.discriminator('archived', archivedProperties);
|
||||
|
||||
//Export mongoose model based on archivedSchema
|
||||
module.exports = mongoose.model("archivedMedia", archivedMediaSchema);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 Rainbownapkin and the TTN Community
|
||||
Copyright (C) 2024-2026 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue