Compare commits
15 commits
0.4-indev-
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60338eaeb1 | ||
|
|
27ab1c2c71 | ||
|
|
c3d435a0a3 | ||
|
|
ed656cb530 | ||
|
|
37e9658d51 | ||
|
|
dd4d789d9f | ||
|
|
ecebcf0d32 | ||
|
|
eaca9db987 | ||
|
|
fe957e4083 | ||
|
|
e7558d7d9d | ||
|
|
ce7be33a67 | ||
|
|
e94914a152 | ||
|
|
bd8a03d72f | ||
|
|
be01417cdf | ||
|
|
d7c55fe3da |
|
|
@ -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.4-INDEV Hotfix 1
|
||||
0.1-Alpha
|
||||
=========
|
||||
|
||||
Canopy - /ˈkæ.nə.pi/:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"name": "canopy-of-indev",
|
||||
"version": "0.4",
|
||||
"name": "canopy-of-alpha",
|
||||
"version": "0.1",
|
||||
"canopyDisplayVersion": "0.1-Alpha",
|
||||
"license": "AGPL-3.0-only",
|
||||
"dependencies": {
|
||||
"@braintree/sanitize-url": "^7.1.1",
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
|||
|
||||
//Config
|
||||
const config = require('../../config.json');
|
||||
const package = require('../../package.json');
|
||||
|
||||
//Local Imports
|
||||
const csrfUtils = require('../utils/csrfUtils');
|
||||
|
|
@ -23,5 +24,5 @@ const csrfUtils = require('../utils/csrfUtils');
|
|||
//register page functions
|
||||
module.exports.get = async function(req, res){
|
||||
//Render page
|
||||
return res.render('about', {aboutText: config.aboutText, instance: config.instanceName, user: req.session.user, csrfToken: csrfUtils.generateToken(req)});
|
||||
return res.render('about', {aboutText: config.aboutText, instance: config.instanceName, user: req.session.user, version: package.canopyDisplayVersion, csrfToken: csrfUtils.generateToken(req)});
|
||||
}
|
||||
|
|
@ -33,17 +33,14 @@ module.exports.post = async function(req, res){
|
|||
const data = matchedData(req);
|
||||
|
||||
//make sure we're not bullshitting ourselves here.
|
||||
if(user == null){
|
||||
res.status(400);
|
||||
return res.send('Invalid Session! Cannot delete account while logged out!');
|
||||
if(user == null || user.user == null){
|
||||
return errorHandler(res, 'You must be logged in to delete your account!', 'unauthorized');
|
||||
}
|
||||
|
||||
const userDB = await userModel.findOne(user);
|
||||
|
||||
const userDB = await userModel.findOne({user: user.user});
|
||||
|
||||
if(!userDB){
|
||||
res.status(400);
|
||||
return res.send('Invalid User! Account must exist in order to delete!');
|
||||
return errorHandler(res, 'User not found!', 'unauthorized');
|
||||
}
|
||||
|
||||
await userDB.nuke(data.pass);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,13 @@ module.exports.post = async function(req, res){
|
|||
const {field, change} = data;
|
||||
const {user} = req.session;
|
||||
|
||||
const userDB = await userModel.findOne(user);
|
||||
//If the user is null
|
||||
if(user == null || user.user == null){
|
||||
//BEFORE YOU BREAK MY HEART!!!
|
||||
return errorHandler(res, 'You must be logged in to preform this action!', 'unauthorized');
|
||||
}
|
||||
|
||||
const userDB = await userModel.findOne({user: user.user});
|
||||
const update = {};
|
||||
|
||||
|
||||
|
|
@ -86,8 +92,7 @@ module.exports.post = async function(req, res){
|
|||
res.status(200);
|
||||
return res.send(update);
|
||||
}else{
|
||||
res.status(400);
|
||||
return res.send({errors: [{msg:"User not found!"}]});
|
||||
return errorHandler(res, 'User not found!', 'unauthorized');
|
||||
}
|
||||
}else{
|
||||
res.status(400);
|
||||
|
|
|
|||
|
|
@ -217,13 +217,22 @@ migrationSchema.statics.ingestLegacyUser = async function(rawProfile){
|
|||
return;
|
||||
}
|
||||
|
||||
//Pull rank, dropping over-ranked users down to current enum length
|
||||
let rank = Math.min(Math.max(0, profileArray[3]), permissionModel.rankEnum.length - 1);
|
||||
|
||||
//If this user was a mod on the old site
|
||||
if(rank == 2){
|
||||
//Set them up as a mod here
|
||||
rank = permissionModel.rankEnum.length - 2;
|
||||
}
|
||||
|
||||
|
||||
//Create migration profile object from scraped info
|
||||
const migrationProfile = new this({
|
||||
user: profileArray[1],
|
||||
pass: profileArray[2],
|
||||
//Clamp rank to 0 and the max setting allowed by the rank enum
|
||||
rank: Math.min(Math.max(0, profileArray[3]), permissionModel.rankEnum.length - 1),
|
||||
rank,
|
||||
email: validator.normalizeEmail(profileArray[4]),
|
||||
date: profileArray[7],
|
||||
})
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ const apiRouter = require('./routers/apiRouter');
|
|||
|
||||
//Define Config variables
|
||||
const config = require('../config.json');
|
||||
const package = require('../package.json');
|
||||
const port = config.port;
|
||||
const dbUrl = `mongodb://${config.db.user}:${config.db.pass}@${config.db.address}:${config.db.port}/${config.db.database}`;
|
||||
|
||||
|
|
@ -208,7 +209,7 @@ Might be better if she kicked off everything at once, and ran a while loop to ch
|
|||
This runs once at server startup, and most startups will run fairly quickly so... Not worth it?*/
|
||||
async function asyncKickStart(){
|
||||
//Lettum fuckin' know wassup
|
||||
console.log(`${config.instanceName}(Powered by Canopy) is booting up!`);
|
||||
console.log(`${config.instanceName}(Powered by Canopy ${package.canopyDisplayVersion}) is booting up!`);
|
||||
|
||||
//Run legacy migration
|
||||
await migrationModel.ingestLegacyDump();
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. %>
|
|||
it was decided that the original cytube fork, fore.st, had been run past it's prime. In summer/fall 2024, work began on a
|
||||
replacement. The resulting software became <a href="https://git.ourfore.st/rainbownapkin/canopy">Canopy</a>, which was
|
||||
first used to run the ourfore.st instance in late 2025.</p>
|
||||
<br>
|
||||
<h2>Canopy Ver: <%= version %></h2>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -337,6 +337,8 @@ function onYouTubeIframeAPIReady(){
|
|||
//Set embed api to true
|
||||
client.ytEmbedAPILoaded = true;
|
||||
|
||||
//If the player is ready and has a mediaHandler loaded
|
||||
if(client.player != null && client.player.mediaHandler != null){
|
||||
//Get currently playing item
|
||||
const nowPlaying = client.player.mediaHandler.nowPlaying;
|
||||
|
||||
|
|
@ -345,6 +347,7 @@ function onYouTubeIframeAPIReady(){
|
|||
//Restart the video now that the embed api has loaded
|
||||
client.player.start({media: nowPlaying});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const client = new channel();
|
||||
|
|
@ -907,6 +907,10 @@ class hlsLiveStreamHandler extends hlsBase{
|
|||
return;
|
||||
}
|
||||
|
||||
//Resize chat box to video aspect, since this is the only event thats reliably called on ratio change
|
||||
//Re-enforcing UX rules a little more often shouldnt cause too many issues anywho.
|
||||
this.client.chatBox.resizeAspect();
|
||||
|
||||
//Calculate distance to end of stream
|
||||
const difference = this.video.duration - this.video.currentTime;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class pmPanel extends panelObj{
|
|||
* @param {channel} client - Parent client Management Object
|
||||
* @param {Document} panelDocument - Panel Document
|
||||
*/
|
||||
constructor(client, panelDocument){
|
||||
constructor(client, panelDocument, startSesh){
|
||||
super(client, "Private Messaging", "/panel/pm", panelDocument);
|
||||
|
||||
/**
|
||||
|
|
@ -71,7 +71,17 @@ class pmPanel extends panelObj{
|
|||
//Tell PMHandler to start tracking this panel
|
||||
this.client.pmHandler.panelList.set(this.uuid, null);
|
||||
|
||||
//Define network related listeners
|
||||
this.defineListeners();
|
||||
|
||||
//If a start sesh was provided
|
||||
if(startSesh != null && startSesh != ""){
|
||||
//Send message out to server
|
||||
this.client.pmSocket.emit("pm", {
|
||||
recipients: startSesh.split(" "),
|
||||
msg: ""
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
closer(){
|
||||
|
|
@ -126,7 +136,6 @@ class pmPanel extends panelObj{
|
|||
this.seshSendButton.addEventListener("click", this.send.bind(this));
|
||||
this.seshBuffer.addEventListener('scroll', this.scrollHandler.bind(this));
|
||||
this.ownerDoc.defaultView.addEventListener('resize', this.handleAutoScroll.bind(this));
|
||||
|
||||
}
|
||||
|
||||
startSesh(event){
|
||||
|
|
@ -180,6 +189,12 @@ class pmPanel extends panelObj{
|
|||
* Render out current sesh array to sesh list UI
|
||||
*/
|
||||
renderSeshList(){
|
||||
//If we don't have a sesh list
|
||||
if(this.seshList == null){
|
||||
//Fuck off, you're not even done building the object yet.
|
||||
return;
|
||||
}
|
||||
|
||||
//Clear out the sesh list
|
||||
this.seshList.innerHTML = "";
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,8 @@ class userList{
|
|||
function renderContextMenu(event){
|
||||
//Setup menu map
|
||||
let menuMap = new Map([
|
||||
["Profile", ()=>{this.client.cPanel.setActivePanel(new panelObj(this.client, `${user.user}`, `/panel/profile?user=${user.user}`))}],
|
||||
["Profile", ()=>{this.client.cPanel.setActivePanel(new panelObj(this.client, user.user, `/panel/profile?user=${user.user}`))}],
|
||||
["PM", ()=>{this.client.cPanel.setActivePanel(new pmPanel(client, undefined, user.user))}],
|
||||
["Mention", ()=>{this.client.chatBox.catChat(`${user.user} `)}],
|
||||
["Toke With", ()=>{this.client.chatBox.tokeWith(user.user)}],
|
||||
]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue