Skip to content

Commit a164394

Browse files
committed
Merge branch 'release-2.12.12' into release
2 parents 5147cc3 + cb7631d commit a164394

File tree

8 files changed

+94
-16
lines changed

8 files changed

+94
-16
lines changed

client/modules/IDE/pages/IDEView.jsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,37 @@ function WarnIfUnsavedChanges() {
8787
);
8888
}
8989

90+
function Banner() {
91+
// temporary banner to display funding opportunities
92+
const [textObj, setTextObj] = useState({});
93+
94+
useEffect(() => {
95+
const grant1 = {
96+
copy:
97+
'Learn to make art with AI with the Social Software High School Summer Institute. Apply by June 1!',
98+
url: 'https://summer.ucla.edu/program/social-software-summer-institute/'
99+
};
100+
101+
const grant2 = {
102+
copy:
103+
'Join us in contributing to p5.js——receive a $10,000 opportunity to grow within the contributor community!',
104+
url: 'https://processingfoundation.org/grants'
105+
};
106+
107+
const allMessages = [grant1, grant2];
108+
const randomIndex = Math.floor(Math.random() * allMessages.length);
109+
const randomMessage = allMessages[randomIndex];
110+
111+
setTextObj(randomMessage);
112+
}, []);
113+
114+
return (
115+
<div className="banner">
116+
<a href={textObj.url}>{textObj.copy}</a>
117+
</div>
118+
);
119+
}
120+
90121
export const CmControllerContext = React.createContext({});
91122

92123
const IDEView = () => {
@@ -170,6 +201,7 @@ const IDEView = () => {
170201
<Helmet>
171202
<title>{getTitle(project)}</title>
172203
</Helmet>
204+
<Banner />
173205
<IDEKeyHandlers getContent={() => cmRef.current?.getContent()} />
174206
<WarnIfUnsavedChanges />
175207
<Toast />

client/styles/layout/_ide.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@
1616
width: 100%;
1717
}
1818

19+
.banner {
20+
width: 100%;
21+
min-height: 2.2rem;
22+
text-align: center;
23+
padding: 0.5rem;
24+
font-weight: bold;
25+
border-bottom: 1px dashed #A6A6A6;
26+
27+
@media (max-width: 770px) {
28+
min-height: 3.3rem;
29+
}
30+
}
31+
1932
.sidebar {
2033
width: 100%;
2134
height: 100%;

kubernetes_app.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ spec:
6565
selector:
6666
matchLabels:
6767
app: web-editor
68-
replicas: 3
68+
replicas: 4
6969
template:
7070
metadata:
7171
labels:
@@ -99,8 +99,8 @@ metadata:
9999
name: web-editor-node
100100
namespace: production
101101
spec:
102-
maxReplicas: 6
103-
minReplicas: 2
102+
maxReplicas: 9
103+
minReplicas: 3
104104
scaleTargetRef:
105105
apiVersion: extensions/v1beta1
106106
kind: Deployment

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "p5.js-web-editor",
3-
"version": "2.12.11",
3+
"version": "2.12.12",
44
"description": "The web editor for p5.js.",
55
"scripts": {
66
"clean": "rimraf dist",

server/controllers/user.controller.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,16 @@ export async function updateSettings(req, res) {
295295
}
296296
user.username = req.body.username;
297297

298+
if (req.body.newPassword) {
299+
if (user.password === undefined) {
300+
user.password = req.body.newPassword;
301+
saveUser(res, user);
302+
}
303+
if (!req.body.currentPassword) {
304+
res.status(401).json({ error: 'Current password is not provided.' });
305+
return;
306+
}
307+
}
298308
if (req.body.currentPassword) {
299309
const isMatch = await user.comparePassword(req.body.currentPassword);
300310
if (!isMatch) {

server/previewServer.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,24 @@ const app = new Express();
1515
// This also works if you take out the mongoose connection
1616
// but i have no idea why
1717
const mongoConnectionString = process.env.MONGO_URL;
18+
1819
// Connect to MongoDB
19-
mongoose.Promise = global.Promise;
20-
mongoose.connect(mongoConnectionString, {
21-
useNewUrlParser: true,
22-
useUnifiedTopology: true
23-
});
20+
const connectToMongoDB = async () => {
21+
try {
22+
await mongoose.connect(mongoConnectionString, {
23+
useNewUrlParser: true,
24+
useUnifiedTopology: true,
25+
useCreateIndex: true,
26+
useFindAndModify: false
27+
});
28+
} catch (error) {
29+
console.error('Failed to connect to MongoDB: ', error);
30+
process.exit(1);
31+
}
32+
};
33+
34+
connectToMongoDB();
35+
2436
mongoose.set('useCreateIndex', true);
2537
mongoose.connection.on('error', () => {
2638
console.error(

server/server.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,22 @@ app.use('/', passportRoutes);
152152
require('./config/passport');
153153

154154
// Connect to MongoDB
155-
mongoose.Promise = global.Promise;
156-
mongoose.connect(mongoConnectionString, {
157-
useNewUrlParser: true,
158-
useUnifiedTopology: true
159-
});
155+
const connectToMongoDB = async () => {
156+
try {
157+
await mongoose.connect(mongoConnectionString, {
158+
useNewUrlParser: true,
159+
useUnifiedTopology: true,
160+
useCreateIndex: true,
161+
useFindAndModify: false
162+
});
163+
} catch (error) {
164+
console.error('Failed to connect to MongoDB: ', error);
165+
process.exit(1);
166+
}
167+
};
168+
169+
connectToMongoDB();
170+
160171
mongoose.set('useCreateIndex', true);
161172
mongoose.connection.on('error', () => {
162173
console.error(

0 commit comments

Comments
 (0)