A lot of refactoring, and etc #232
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: serg2-mirrors/GDBrowser#232
Loading…
Reference in a new issue
No description provided.
Delete branch "Rudxain/patch-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #246
The title is self-descriptive. I also renamed misleading names of functions, and activated JS strict mode.
I made small style changes, like making 1-liner functions actually use 1 line, and splitting long lines of property access into multiple lines for easier reading
Wait, I forgot to check if any renamed function is used outside the file. I'll convert to draft
It seems no functionality should break after renaming, AFAIK
I need to do more refactoring and solve the commit incompatibility. Converting to draft
(whoops sorry)
new conflicts aside this looks good, i was just reluctant at first since theres things i do and dont like
It's okay. I realized I made a mistake in the formatting. For example, I found an
else
clause formatted like this:And I thought it was a whitespace typo because it looked weird and unique, but then I found it's actually a pattern found in many places lol
oh this is always how i've done it, pls dont change
lmao, I was using a VScode extension to edit repos remotely without cloning, and I thought I had to type the branch name everytime I wanted to commit. Sorry for any confusion to everyone. Now the commits are named using unhelpful names
I'm almost done with this PR. If I have enough time, it'll be ready in some hours (or a day) and the commit will also fix #246 .
I did some tests, but I didn't do any tests for stuff that I read enough (both GDB code and MDN docs). I also didn't test if activating strict mode throws an error somewhere lol, the code seems hi-quality enough that we don't need to worry about invalid code.
Also,
randRange
may not be available due to a race condition while loadingglobal.js
, but since the script explicitly starts loading in the HTML beforerandRange
is called, it seems the glitch is unlikely to happen. I guess I can test that, because I don't need NodeJS for that (I don't have NodeJS installed yet, lol)Incomplete string escaping or encoding
This replaces only the first occurrence of '}}'.
Show more details
Incomplete string escaping or encoding
This replaces only the first occurrence of '{{'.
Show more details
I realized
replaceAll
is better there@GDColon It's ready. But I'm afraid there may be a bug or syntax error somewhere lol, sorry
Wait, I realized that the
split
method has a 2nd arg that can improve speed and memory use (only in engines that don't optimize well).Also, the XOR class can be refactored to convert all its
prototype.*
methods intostatic
ones, that will allow you to do this:instead of this:
Edit: I found a possible problem,
app.xor
. It seems like that property must be an object instance ofXOR
, I don't know why lolI need help refactoring
obj.foo && obj.foo.bar
intoobj.foo?.bar
. I don't know which ones can be replaced and which not, I tried searching but only got a vague idea@GDColon I found broken
<script src="...">
URLs, like "../icon.js" instead of "/iconkit/icon.js", and "../global.js" instead of "/misc/global.js". I'm fixing it nowWait holup. I realized the deployed website has a different dir tree, so those paths seem to work?
I noticed
iconkit.html
doesn't runglobal.js
, why is that?@ -343,4 +397,4 @@
else newIconCounts[formName]++
}
})
sacredTexts.newIconCounts = newIconCounts
Missing rate limiting
This route handler performs a file system access, but is not rate-limited.
Show more details
Missing rate limiting
This route handler performs a file system access, but is not rate-limited.
Show more details
@ -1,3 +2,3 @@
const crypto = require('crypto')
function sha1(data) { return crypto.createHash("sha1").update(data, "binary").digest("hex"); }
const sha1 = data => crypto.createHash("sha1").update(data, "binary").digest("hex")
Use of a broken or weak cryptographic algorithm
Sensitive data from an access to username is used in a broken or weak cryptographic algorithm.
Sensitive data from an access to userName is used in a broken or weak cryptographic algorithm.
Show more details
@ -1,3 +2,3 @@
const crypto = require('crypto')
function sha1(data) { return crypto.createHash("sha1").update(data, "binary").digest("hex"); }
const sha1 = data => crypto.createHash("sha1").update(data, "binary").digest("hex")
Use of a broken or weak cryptographic algorithm
Sensitive data from an access to username is used in a broken or weak cryptographic algorithm.
Sensitive data from an access to userName is used in a broken or weak cryptographic algorithm.
Show more details
Inclusion of functionality from an untrusted source
Script loaded from content delivery network with no integrity check.
Show more details
@ -261,4 +261,3 @@
if (dailyTime) {
$('#dailyTime').html(` (${colonize(dailyTime, true)})`)
setInterval(() => {
Potentially unsafe external link
External links without noopener/noreferrer are a potential security risk.
Show more details
Wait what? I thought that's just the minified version. Is this because I didn't modify
package.json
to reflect the new dependency?@ -1,3 +2,3 @@
const crypto = require('crypto')
function sha1(data) { return crypto.createHash("sha1").update(data, "binary").digest("hex"); }
const sha1 = data => crypto.createHash("sha1").update(data, "binary").digest("hex")
LMAO I just changed the function to arrow fn
@ -1,3 +2,3 @@
const crypto = require('crypto')
function sha1(data) { return crypto.createHash("sha1").update(data, "binary").digest("hex"); }
const sha1 = data => crypto.createHash("sha1").update(data, "binary").digest("hex")
Bruh
@ -261,4 +261,3 @@
if (dailyTime) {
$('#dailyTime').html(` (${colonize(dailyTime, true)})`)
setInterval(() => {
Is this because of using "/" instead of "../"?
I think this PR is too big now. I'll re-review to see if I made more mistakes, and only fix those mistakes in this PR. Any further changes will be done in a separate PR
@ -18,4 +18,3 @@
[ "Cyclic", 30, 3, 12, 0 ],
[ "DanZmeN", 104, 34, 12, 1 ],
[ "DanZmeN", 104, 34, 12, 1 ],
[ "envylol", 73, 20, 1, 1],
DanZmeN was duped lol
I'm reverting those URLs because I didn't test if they work
Why did I delete this?
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.