Commit Graph
72 Commits
Author SHA1 Message Date
Patrick Quist 9b983d6965 Load and show creation_date of shortlink (#5236) 2023-07-17 23:36:36 +02:00
Matt Godbolt 87024e2239 Bump latest deps (#5252) 2023-07-10 21:31:04 -05:00
Matt Godbolt 2b6500203e Update to latest AWS SDK (#4818)
We're not using the new `send` functionality, but this gets everything
running and tests passing. It has _not_ been tested against real AWS
yet. That's next. I might move stuff over to the new `send` API, but
also I might not if it's just working.
2023-03-07 18:10:56 -06:00
Mats Jun LarsenandMatt Godbolt 633eb82d18 Transition to ECMAScript Modules (#4780)
Makes the Compiler Explorer app, and all the tooling ESM compatible.
Things that have been done:

1. The package.json has `type: module` now
2. All relative imports have a .js ending
3. All directory imports are now directory/index.js to comply with ESM
standards
4. Dependency node-graceful is now imported into tree, because the
package is broken under esm
5. Dependency p-queue has been bumped to 7.x with ESM support
6. Dependency profanities has been bumped to 3.x with ESM support
7. Webpack config is now both ESM and CommonJS compatible
8. Non-ESM compatible imports have been rewritten
9. ESLint configuration has been tweaked to not fail on .js imports
10. Mocha is now hacked together and ran with ts-node-esm
11. Webpack is now hacked together and ran with ts-node-esm
12. Webpack config is now ESM compatible, so that it can be used in the
dev server
13. Cypress code still runs commonjs, and has been excluded from the
tsconfig
14. All sinon mock tests have been commented out, because sinon module
mocks do not work with ESModules (because ESModules are immutable)

A lot of tests are now giving warnings/errors to stdout, yet still pass.
Docenizer codegenerator scripts have been updated, but I did not re-run
them, and instead just changed their code.

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2023-02-27 18:06:38 -06:00
Jeremy Rifkin 384c297906 Fix trailing comma issue (#4775)
Make trailing commas more consistent throughout the project, fixes
config conflict between eslint and prettier. Resolves an oversight in
#4766.
2023-02-26 12:21:35 -05:00
Jeremy Rifkin 2b06c69111 Turn some auto-fixable eslint rules back on (#4766)
This PR turns comma-dangle and indent eslint rules on for lib/. These
are rules inherited from the eslint config for static/, this PR just
makes things more consistent. Also turned
@typescript-eslint/no-var-requires back on while I was here.
2023-02-23 17:16:17 -05:00
Jeremy Rifkin e2b84eb5a6 Tsify lib/handlers/api (#4704)
<!-- THIS COMMENT IS INVISIBLE IN THE FINAL PR, BUT FEEL FREE TO REMOVE
IT
Thanks for taking the time to improve CE. We really appreciate it.
Before opening the PR, please make sure that the tests & linter pass
their checks,
  by running `make check`.
In the best case scenario, you are also adding tests to back up your
changes,
  but don't sweat it if you don't. We can discuss them at a later date.
Feel free to append your name to the CONTRIBUTORS.md file
Thanks again, we really appreciate this!
-->
2023-02-10 22:52:04 -05:00
Matt Godbolt 749319f791 Slightly more controversial bumpings (#4503)
- latest sentry, tar-stream, which, some yamljs versions
- latest eslint-* stuff
- latest webpack manifest
- Applies all the automatic fixes for newer lint rules
- Bump the webpack version

applies new tslint stuff
2022-12-28 11:42:14 -06:00
Jeremy Rifkin 993c363126 Tsify lib/storage (#4499)
* Tsify lib/storage

* Add @types/request

* Fix get/post types

* Better type solution
2022-12-28 10:19:04 -07:00
Matt Godbolt f2c1e0bd31 The Grand Reformat (#3643)
* The Grand Reformat

- everything made prettier...literally
- some tweaks to include a few more files, including documentation
- minor changes to format style
- some tiny `// prettier-ignore` changes to keep a few things the way we like them
- a couple of super minor tweaks to embedded document types to ensure they format correctly
2022-05-09 23:13:50 -05:00
Matt Godbolt cb50486d27 Bump eslint dependencies and suppress most of the warnings 2021-05-27 23:06:42 -05:00
Matt Godbolt 259b72e16a Add some tests to s3 storage 2021-04-12 17:46:53 -05:00
Austin Morton a194b5a591 Always store shortlinks with a 6 character prefix in dynamodb 2021-04-09 20:06:06 -04:00
Austin Morton 80fa894cd0 Store shortlinks with both 6 and 9 character prefixs in dynamodb 2021-04-09 17:47:14 -04:00
Matt Godbolt 6fcf5d758f Increase the number of characters in s3 URLs
We used to use 6. This gives 32^6 possible URLs.
As we increase the number of URLs the godbolt.org site
stores, the chance of an attacker being able to guess
existing URLs has increased. To stay one step ahead,
we bump to 9 characetrs here: 32^9 possible is 35 trillion
possibilities.
2021-03-21 15:06:53 -05:00
Matt Godbolt 17b2bb8a58 Move /shortener to /api/shortener (#2426)
We still support /shortener (though will scrape logs to see when
we can remove).

The route under /api/shortener will have the CORS headers set up
properly for things like @foonathan's lexy visualiser.
2021-02-15 12:52:46 -06:00
Austin Morton de85aecc7d Normalize and enforce license disclaimer headers (#2234) 2020-09-27 00:20:19 -04:00
Austin Morton 044dcfbf88 Use ES6 Modules (#2132) 2020-09-26 16:59:26 -04:00
Austin Morton bac07fea6d Eliminate all dynamic require statements (#2230) 2020-09-25 11:21:30 -04:00
Austin Morton dde5ef02fa Move some files in preparation for es6 modules 2020-09-23 04:30:15 -04:00
Rubén Rincón BlancoandAustin Morton ccff4b9ee5 Add new eslint rules (#2121)
The largest changes here are:
- enforcing single quotes for strings
- enforcing trailing commas where possible

In addition to those we have enabled several eslint plugins:
- plugin:requirejs/recommended, to enforce some conventions in require statements
- plugin:node/recommended, to enforce correct usage of various node.js APIs
- plugin:unicorn/recommended, which contains a pretty mixed bag of useful rules

This PR attempts to not change code behavior when possible.  In cases where fixing
existing code would change semantics, a linting exclusion has been placed in the 
code base to silence the error.  You can find these by searching for `eslint-disable-next-line`.

Co-authored-by: Austin Morton <austinpmorton@gmail.com>
2020-08-04 16:39:02 -04:00
Rubén Rincón Blanco 1106db4939 Make url hash a base32 encode (#2062)
Avoids most of the problems present with the current base64 impl
2020-07-06 08:33:10 -04:00
Matt Godbolt 74780f3d49 More consisetency in storage handling. Thanks again @apmorton 2020-01-28 22:34:14 -06:00
Matt Godbolt 717ea51a3e First wave of @apmorton suggestions and fixes 2020-01-28 21:34:52 -06:00
Matt Godbolt c589e08025 Asyncify storage 2020-01-21 19:21:41 -06:00
Matt Godbolt fdab41d966 Use res.send() in most cases.
I discovered res.send() will set cache control headers, content-size,
and content-type, and will to-json objects (setting type to app/json).
Refactored a few things, hit an issue where testing chai http doesn't
seem to want to remember the data (in health check tests); reading the
chai http docs I don't actually think it's supported. Was working by
fluke before.

Took the opportunity to use a few "extract method" in the IDE too to
remove duplicated code (that the IDE was also nagging me about...)
2020-01-13 07:29:08 -06:00
RabsRincon 05edc75848 Add missing cache headers for some files 2020-01-08 13:54:43 +01:00
RabsRincon f733d6f3cc Make looking for usable text a bit better
It allows more letters, looks closer to the current length
 and has a max try count

Thanks to @jameshamm for a great rundown on what could be done :)

Closes #1706
2019-12-08 02:59:39 +01:00
Rubén Rincón a99531b14d Add i to list of banned letters
Fixes tests
2019-11-04 18:11:01 +01:00
Rubén Rincón 2364ecac75 Disallow confusing leters to appear in short urls
Closes #1661
2019-11-04 18:03:02 +01:00
Austin Morton c64d5dc587 Add remote storage backend (#1549)
Allows a CE instance to utilize another remote CE instance
for shortlink storage
2019-08-26 18:32:13 -04:00
Matt Godbolt 43c69be29d Moving things about to keep the host and subdomain from the original request 2019-05-31 22:03:27 -05:00
Matt Hammerly da696438bc make url shortener handler return entire url 2019-05-29 20:24:45 -07:00
Matt Godbolt d76657fdfd Braino! 2019-03-17 22:21:47 -05:00
Matt Godbolt 2011c840ce Rename thing we add as nonce, add tests. Fix logic error 2019-03-17 22:02:04 -05:00
RabsRincon bde3e829cf Implement profanity check on subhashes
c.f: #1297
2019-03-06 17:18:51 +01:00
jD91mZM2 dddae14df5 Fix warnings 2019-02-23 12:32:34 +01:00
jD91mZM2 1198a1a69c Use storageSolution=null over enableShort=false 2019-02-23 12:26:33 +01:00
RabsRincon c61cee6df5 Better handle missing short id case 2018-11-30 18:18:14 +01:00
RabsRincon 9b1d6624f4 Fix undefined variable access 2018-11-30 17:51:37 +01:00
RabsRincon 98a35ac3d1 Try a new strategy for s3 link expansion 2018-11-30 17:06:20 +01:00
Partouf 667588e527 being able to store and retreive clientstate json 2018-10-02 23:27:06 +02:00
RabsRincon bdc447fe30 Fix local storage & add compiler name to unfurling 2018-08-20 11:10:23 +02:00
Matt Godbolt 08cd1edc69 Use binary buffers for hash; safe64 encode results. Addresses #1056 2018-08-18 10:02:28 -05:00
RabsRincon 895369f932 Move to on-the-fly parsing 2018-08-17 21:07:51 +02:00
RabsRincon fa748a2d43 CamelCasify special_metadata 2018-08-17 20:51:55 +02:00
RabsRincon 9d02f2ed65 Restructure open graph metadata 2018-08-17 20:33:39 +02:00
RabsRincon c89a1cdab0 Create error handlerss 2018-08-13 19:21:24 +02:00
RabsRincon 349bbd41ed Improve 404 message 2018-08-13 17:22:08 +02:00
RabsRincon 9d388f017f Properly handle request ip logging 2018-08-13 16:09:32 +02:00