Reviving An Outdated Project
This week, I did some some maintenance work on Starchart. The project hasn't been worked on in a while so we're trying to update it's dependencies.
DevelopingSpace
/
starchart
A self-serve tool for managing custom domains and certificates
Starchart
Starchart makes it easy for the Seneca developer community to create and manage their own custom subdomains and SSL certificates, without cost or having to provide personal information.
For information about running Starchart, see our deployment guide. For development information, see our contributing guide. For further technical background, planning, and initial designs, please see the wiki.
Introduction
The internet is evolving, and what used to be hard has become simple. For example, hosting your own website used to require knowledge of server administration, operating systems, networking, etc. Today, many developers host their personal and project websites without ever touching a remote server, opting for (free) cloud services like GitHub Pages, Vercel, Netlify, or AWS.
The internet's security model is also evolving. For example, browser vendors have embraced HTTPS everywhere. This is good for security, as it enables certificate-based encryption between clients and servers. However, as with…
The plan was to fix the CI workflow, which we found out was broken last week:
But before I could work out a fix, one of the previous developers, Eakam, solved the issue - turns out it was just because Playwright was outdated.
Bump playwright to 1.49.1
#772

Playwright install is failing in CI (E2E Tests). Bumping playwright version should fix that.
Ref:
I felt like I should make up for it by finding more stuff to work on and thought updating more dependencies would be a great starting point.
Since the project hadn't been worked on for 2 years, there were a bunch of security vulnerabilities stemming from outdated packages. I was able to fix most of them with npm audit fix.
There were a couple more fixes that led to breaking changes in @remix-run/eslint-config and @remix-run/react, so I bumped those manually.
One of the updates (I bumped them at the same time so I can't say for sure but my bet is on /react) led to a type-check error because [@remix-run/react].useNavigation().formData may now be of the type undefined. I fixed it with optional chaining.
// Before const isLoading = navigation.state === 'submitting' && Number(navigation.formData.get('id')) === dnsRecord.id; // After const isLoading = navigation.state === 'submitting' && Number(navigation.formData?.get('id')) === dnsRecord.id;
The other changes I made had to do with some lint errors that popped up (At this point I realized I had my ESLint extension turned off, but I'm sure these warnings came with the update, since it never happened in CI in the past).
- Instances of importing the same module multiple times in one file:
// Before import { getCertificateByUsername } from '~/models/certificate.server'; import { deleteCertificateById } from '~/models/certificate.server'; import { isAdmin } from '~/models/user.server'; import { getUserByUsername } from '~/models/user.server'; // After import { getCertificateByUsername, deleteCertificateById } from '~/models/certificate.server'; import { isAdmin, getUserByUsername } from '~/models/user.server';
- Using let when const is preferred:
// Before let date = val.toLocaleDateString('en-US', { // After const date = val.toLocaleDateString('en-US', {
Surprised it didn't catch these before.
Also, when I turned on the ESLint extension I was a little taken aback because there were ~900 linter errors. Turned out it was because ESLint was linting the output generated by Playwright. So I added /playwright-report to .eslintignore.
And that was the sum of my maintenance work for this sprint. Ended up fixing 30 severe security issues, so not bad.
Update dependencies
#775

Should fix a bunch of security vulnerabilities.
Changes
- [x] Bump dependencies
- [x] Add /playwright-report to .eslintignore
- [x] Fix typecheck and linter errors
I also re-activated Dependabot which bumped vitest a couple minor versions. It'll be nice to not have to manually investigate and patch security vulnerabilities.
In other news, one of my pull requests to Mattermost was finally merged!
[GH-29548] Avoid SELECT * in `tokens_store.go`
#29558

Summary
This PR:
- Switches SQL queries in token_store.go to use SQLBuilder
- Explicitly defines columns in SELECT queries to TokenStore.
- Factors out common queries into the constructor.
Ticket Link
Fixes #29548
Screenshots
Release Note
// Before const isLoading = navigation.state === 'submitting' && Number(navigation.formData.get('id')) === dnsRecord.id; // After const isLoading = navigation.state === 'submitting' && Number(navigation.formData?.get('id')) === dnsRecord.id;
It'd been approved a while ago but it took a few weeks to be merged into main.
In the meantime I've been working on my other PR. I was asked to make some changes and I'm waiting on a re-review.
[MM-53650] Add disable emoticon rendering setting to webapp
#29414

Summary
This pull request adds a user setting to the webapp to toggle rendering emoticons (:D) as emojis (?).
The setting is added as a component in components/user_settings/display/render_emoticons_as_emoji/ which is imported in components/user_settings/display/user_settings_display.tsx.
I've added a renderOnOffLabel() function to user_settings_display.tsx, lifted from components/user_settings/advanced/user_settings_advanced.tsx to help render the new component.
The setting is stored as a user preference using the savePreferences() action.
I've added constants for the preference to utils/constants.tsx and webapp/channels/src/packages/mattermost-redux/src/constants/preferences.ts.
To actually use the setting, I've modified components/post_markdown to receive it's value as a prop, for which I've used getBool() and added a default value to the config. post_markdown passes this value down to Markdown on the options object, which then passes it down to utils/text_formatting.tsx, which finally passes the value to emoticons.tsx as a newly added parameter. emoticons.tsx checks whether the value is true and if it is, it transforms the emoticons into emojis.
I've updated affected tests and created unit tests for the new component. I've also updated the English translation file.
QA Test Steps
- Navigate to User Settings.
- Go to the Display category.
- Find the section labelled "Auto-render emoticons as emoji" and click "Edit".
- Toggle the setting and click "Save".
- Emoticon rendering on messages sent by the current user and other users should be toggled client-side with the setting.
Ticket Link
Fixes (partially) https://github.com/mattermost/mattermost/issues/26504 Jira https://mattermost.atlassian.net/browse/MM-53650
Note the issue and ticket describe adding this feature to the mobile app as well, which this PR does not.
Screenshots
before | after |
---|---|
![]() |
![]() |
Release Note
// Before const isLoading = navigation.state === 'submitting' && Number(navigation.formData.get('id')) === dnsRecord.id; // After const isLoading = navigation.state === 'submitting' && Number(navigation.formData?.get('id')) === dnsRecord.id;
Working on this PR was interesting because when I first submitted it I didn't even entirely understand my changes. Going back into it after a long while away and with the feedback from the reviews helped me look at it from a fresh perspective and understand it better.
The Mattermost app gets user setting state from both "preferences" and from a "config". I added my setting to both, mimicking one of the existing settings I was advised to reference, but it turned out the "config" is for server-level settings, while this new setting was intended to be a client-side option. The reviews helped me understand where I went wrong, and it actually ended up being a smaller change than I thought necessary.
Overall I'd say it was a fairly productive week.
The above is the detailed content of Reviving An Outdated Project. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

The main uses of JavaScript in web development include client interaction, form verification and asynchronous communication. 1) Dynamic content update and user interaction through DOM operations; 2) Client verification is carried out before the user submits data to improve the user experience; 3) Refreshless communication with the server is achieved through AJAX technology.

JavaScript's application in the real world includes front-end and back-end development. 1) Display front-end applications by building a TODO list application, involving DOM operations and event processing. 2) Build RESTfulAPI through Node.js and Express to demonstrate back-end applications.

Understanding how JavaScript engine works internally is important to developers because it helps write more efficient code and understand performance bottlenecks and optimization strategies. 1) The engine's workflow includes three stages: parsing, compiling and execution; 2) During the execution process, the engine will perform dynamic optimization, such as inline cache and hidden classes; 3) Best practices include avoiding global variables, optimizing loops, using const and lets, and avoiding excessive use of closures.

Python and JavaScript have their own advantages and disadvantages in terms of community, libraries and resources. 1) The Python community is friendly and suitable for beginners, but the front-end development resources are not as rich as JavaScript. 2) Python is powerful in data science and machine learning libraries, while JavaScript is better in front-end development libraries and frameworks. 3) Both have rich learning resources, but Python is suitable for starting with official documents, while JavaScript is better with MDNWebDocs. The choice should be based on project needs and personal interests.

Both Python and JavaScript's choices in development environments are important. 1) Python's development environment includes PyCharm, JupyterNotebook and Anaconda, which are suitable for data science and rapid prototyping. 2) The development environment of JavaScript includes Node.js, VSCode and Webpack, which are suitable for front-end and back-end development. Choosing the right tools according to project needs can improve development efficiency and project success rate.

C and C play a vital role in the JavaScript engine, mainly used to implement interpreters and JIT compilers. 1) C is used to parse JavaScript source code and generate an abstract syntax tree. 2) C is responsible for generating and executing bytecode. 3) C implements the JIT compiler, optimizes and compiles hot-spot code at runtime, and significantly improves the execution efficiency of JavaScript.
