Skip to content

Commit

Permalink
Merge branch 'release-2.15.1' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
raclim committed Nov 5, 2024
2 parents 511f83e + 2726cc5 commit 6a632a2
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 22 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "p5.js-web-editor",
"version": "2.15.0",
"version": "2.15.1",
"description": "The web editor for p5.js.",
"scripts": {
"clean": "rimraf dist",
Expand Down
4 changes: 2 additions & 2 deletions server/domain-objects/createDefaultFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ function draw() {
export const defaultHTML = `<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.0/p5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.0/addons/p5.sound.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.1/p5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.1/addons/p5.sound.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="utf-8" />
Expand Down
5 changes: 4 additions & 1 deletion server/migrations/emailConsolidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ const mongoConnectionString = process.env.MONGO_URL;
const { ObjectId } = mongoose.Types;
// Connect to MongoDB
mongoose.Promise = global.Promise;
mongoose.connect(mongoConnectionString);
mongoose.connect(mongoConnectionString, {
useNewUrlParser: true,
useUnifiedTopology: true
});
mongoose.set('strictQuery', true);
mongoose.connection.on('error', () => {
console.error(
Expand Down
2 changes: 2 additions & 0 deletions server/previewServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const connectToMongoDB = async () => {
mongoose.set('strictQuery', true);

await mongoose.connect(mongoConnectionString, {
useNewUrlParser: true,
useUnifiedTopology: true,
serverSelectionTimeoutMS: 30000, // 30 seconds timeout
socketTimeoutMS: 45000 // 45 seconds timeout
});
Expand Down
5 changes: 4 additions & 1 deletion server/scripts/examples-gg-latest.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ const headers = { 'User-Agent': 'p5js-web-editor/0.0.1' };

const mongoConnectionString = process.env.MONGO_URL;

mongoose.connect(mongoConnectionString);
mongoose.connect(mongoConnectionString, {
useNewUrlParser: true,
useUnifiedTopology: true
});
mongoose.set('strictQuery', true);
mongoose.connection.on('error', () => {
console.error(
Expand Down
5 changes: 4 additions & 1 deletion server/scripts/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ const headers = { 'User-Agent': 'p5js-web-editor/0.0.1' };

const mongoConnectionString = process.env.MONGO_URL;

mongoose.connect(mongoConnectionString);
mongoose.connect(mongoConnectionString, {
useNewUrlParser: true,
useUnifiedTopology: true
});
mongoose.set('strictQuery', true);
mongoose.connection.on('error', () => {
console.error(
Expand Down
24 changes: 10 additions & 14 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,14 @@ app.use(cookieParser());

mongoose.set('strictQuery', true);

async function connectToMongoDB() {
try {
const mongooseConnection = await mongoose.connect(mongoConnectionString, {
serverSelectionTimeoutMS: 30000, // 30 seconds timeout
socketTimeoutMS: 45000 // 45 seconds timeout
});
return mongooseConnection.connection.getClient();
} catch (err) {
throw new Error('MongoDB connection failed', err);
}
}

const clientInstancePromise = connectToMongoDB();
const clientPromise = mongoose
.connect(mongoConnectionString, {
useNewUrlParser: true,
useUnifiedTopology: true,
serverSelectionTimeoutMS: 30000, // 30 seconds timeout
socketTimeoutMS: 45000 // 45 seconds timeout
})
.then((m) => m.connection.getClient());

app.use(
session({
Expand All @@ -102,7 +97,8 @@ app.use(
secure: false
},
store: new MongoStore({
clientPromise: clientInstancePromise
clientPromise,
autoReconnect: true
})
})
);
Expand Down

0 comments on commit 6a632a2

Please sign in to comment.