Skip to content

Commit 42a6003

Browse files
author
Sven Fehler
authored
Merge pull request #194 from Sv443/wip/2.3.0
2 parents 5b3c51c + 7837ab3 commit 42a6003

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+6158
-1587
lines changed

.github/Contributing.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ So please read this guide before contributing. Thanks :)
1212
<br><br><br><br>
1313

1414
## Submitting or editing jokes:
15-
To submit a joke manually, you can use the form on [this page.](https://sv443.net/jokeapi/v2/#submit)
16-
To submit it through code, you can make use of the ["submit" endpoint.](https://sv443.net/jokeapi/v2/#submit-endpoint)
15+
To submit a joke manually, you can use the form on [this page.](https://v2.jokeapi.dev/#submit)
16+
To submit it through code, you can make use of the ["submit" endpoint.](https://v2.jokeapi.dev/#submit-endpoint)
1717

1818
If you instead want to *edit* a joke, you can find them in the `jokes-xy.json` files in [`data/jokes/`](../data/jokes/)
1919
Please then follow the [code contribution section](#submitting-code) as well.
@@ -27,10 +27,13 @@ Keep in mind, though, that I will not remove jokes based on opinions as that wou
2727
1. [Read the Code_of_Conduct.md file](./Code_of_Conduct.md) (TLDR: just behave in a friendly manner).
2828
2. [Click here](https://github.com/Sv443/JokeAPI/fork) to fork the repository. Afterwards, clone or download it and locate the folder where it is contained.
2929
3. Make the changes you want to make to the code.
30-
4. Run the script `npm run all` which will run these three commands:
30+
4. Run the script `npm run all` which will run these four commands:
3131
- `npm run validate-jokes` to make sure all jokes are formatted correctly.
3232
- `npm run validate-ids` to verify that all jokes have the correct ID.
3333
- `npm run lint` to check the code for any warnings or errors.
34+
- `npm run dep-graph` to generate a new dependency graph.
35+
- `npm run generate-changelog` to generate a Markdown changelog out of the plaintext one.
36+
- `npm run test`, which runs the unit tests for JokeAPI. If you are colorblind, you can run the command `npm run test-colorblind` (will turn green into cyan and red into magenta).
3437
5. Run JokeAPI locally by running the command `node JokeAPI`, request some jokes and test the areas you modified / added to make sure everything still works.
3538
6. Add yourself to the `contributors` object in the [`package.json`](../package.json) file :)
3639
<!-- - **If it doesn't exist or is empty** please add it using the second format on [this website](https://flaviocopes.com/package-json/#contributors) -->
@@ -56,7 +59,7 @@ If you want to submit a translation, please follow these steps:
5659
## Other nice-to-know stuff:
5760
- I really recommend using [Visual Studio Code](https://code.visualstudio.com/) with the extension [`fabiospampinato.vscode-highlight`](https://marketplace.visualstudio.com/items?itemName=fabiospampinato.vscode-highlight) - it will add custom styling to the syntax highlighting in the editor and make the code easier to read and work with.
5861
- If you want to generate a dependency graph, you need to install [Graphviz](https://graphviz.gitlab.io/download/) and add the path to the `bin` folder to your `%PATH%` / `$PATH` environment vaiable. Then, run the command `npm run dependency-graph` and open the file [`dev/dependency-graph.html`](../dev/dependency-graph.html) in a browser.
59-
- If you need to add an authorization token, you can generate one or multiple tokens with the command `npm run add-token [amount]`. If you omit the "amount" parameter, the script will generate a single token. After you run the command, the tokens will be listed in the console and you can now (after restarting JokeAPI) use it in the `Authorization` header to gain unlimited access to JokeAPI.
62+
- If you need to add an authorization token, you can generate one or multiple tokens with the command `npm run add-token [amount]`. If you omit the "amount" parameter, the script will generate a single token. After you run the command, the tokens will be listed in the console and you can now (after restarting JokeAPI) use it in the `Authorization` header to gain unlimited access to JokeAPI [(better explanation here).](https://jokeapi.dev/#api-tokens)
6063

6164
<br><br>
6265

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: Dependent
3+
about: Request your project to be added to the dependent lists in the readme and documentation or suggest an edit to a dependent
4+
title: 'New dependent: '
5+
labels: ⚙️ dependent
6+
assignees: Sv443
7+
8+
---
9+
10+
<!--
11+
If this issue is approved, your project will be added to these dependent lists:
12+
- https://jokeapi.dev/#dependents
13+
- https://github.com/Sv443/JokeAPI#readme (scroll down all the way)
14+
-->
15+
16+
## Link to the project:
17+
<!-- Add a single URL to the dependent project here -->
18+
```
19+
https://github.com/example/My_Project
20+
```
21+
22+
23+
<br><br>
24+
25+
## Link to my personal website / GitHub page (optional):
26+
<!-- Add a single URL to your website or GitHub page (or something similar) here -->
27+
```
28+
https://github.com/example
29+
```
30+
31+
32+
<br><br>
33+
34+
## Is your project explicit or unsafe for minors to view?
35+
<!-- Please check the option that fits your project (add an x between the square brackets or submit the issue, then click the checkbox) -->
36+
- [ ] **Yes**, it contains explicit material
37+
- [ ] **No**, it doesn't contain explicit material
38+
39+
40+
<br><br>
41+
42+
## Notes:
43+
<!-- If you only want your project to show up on one of the dependent lists or you have some other thing you need the developer(s) to know, put it in this section -->
44+
45+
46+
47+
<br><br>
48+
49+
## Checklist:
50+
- [ ] I have added my project's name to the title of this issue
51+
- [ ] I have filled out at least the first URL (second one is optional)
52+
- [ ] I have specified whether or not my project is explicit

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Bug report
33
about: Create a bug report to help improve JokeAPI
44
title: ''
5-
labels: 🕷 bug
5+
labels: bug
66
assignees: Sv443
77

88
---

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ contact_links:
44
-
55
name: "Documentation"
66
about: "Please read the documentation before opening a new issue"
7-
url: "https://sv443.net/jokeapi/v2"
7+
url: "https://jokeapi.dev/"
88
-
99
name: "Chat"
1010
about: "If you have any non-issue-worthy questions, join my Discord server and I'll try to help you"

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818
<!-- Add some screenshots here, if applicable -->
1919

2020
## Checklist
21-
- [ ] I have read the [Contributing Guide](https://github.com/Sv443/JokeAPI/blob/master/.github/Contributing.md)
22-
- [ ] I read and accept the [Code of Conduct](https://github.com/Sv443/JokeAPI/blob/master/.github/Code_of_Conduct.md) (TLDR: just behave in a friendly manner)
21+
- [ ] I have read and followed the [Contributing Guide](https://github.com/Sv443/JokeAPI/blob/master/.github/Contributing.md)
22+
- [ ] I have read and accept the [Code of Conduct](https://github.com/Sv443/JokeAPI/blob/master/.github/Code_of_Conduct.md) (TLDR: just behave in a friendly manner)
2323
- [ ] My code follows the general style of this project
2424
- [ ] I have commented my code, particularly in hard-to-understand areas
2525
- [ ] I have made corresponding changes to the documentation (if applicable)
2626
- [ ] I ensured that the automated checks that ran on this PR have completed successfully
27-
- [ ] I added myself to the `package.json` file (optional)
27+
- [ ] I added myself to the `package.json` file (optional but highly encouraged :)
28+
29+
**^ Not completing the checklist or ignoring what it says will invalidate your contribution and may even ban you from contributing altogether ^**

.github/SECURITY.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
# Security Policy
22

33
## Reporting a Vulnerability
4-
To report a vulnerability or security issue, please directly contact me via [Email](mailto:sven.fehler@web.de) or [Discord](https://sv443.net/discord).
4+
To report a vulnerability or security issue, please directly contact me via [Email](mailto:contact@sv443.net) or [Discord](https://sv443.net/discord).
55
Please **do not** create a GitHub issue!
66

77
## Supported Versions
88
These versions are still supported and will be receiving security updates:
9-
| Version | Supported | Status |
10-
| --- | --- | --- |
11-
| [v1.0](https://github.com/Sv443/JokeAPI/releases/tag/v1.0.0) || deprecated |
12-
| [v1.1](https://github.com/Sv443/JokeAPI/releases/tag/v1.1.3) || deprecated |
13-
| [v2.0](https://github.com/Sv443/JokeAPI/releases/tag/v2.0.1) || outdated |
14-
| [v2.1](https://github.com/Sv443/JokeAPI/releases/tag/v2.1.5) || outdated |
15-
| [v2.2](https://github.com/Sv443/JokeAPI/releases/tag/v2.2.0) || active |
9+
| Version | Supported | Location | Status |
10+
| --- | --- | --- | --- |
11+
| [v1.0](https://github.com/Sv443/JokeAPI/releases/tag/v1.0.0) || `/` | deprecated |
12+
| [v1.1](https://github.com/Sv443/JokeAPI/releases/tag/v1.1.3) || `/` | deprecated |
13+
| [v2.0](https://github.com/Sv443/JokeAPI/releases/tag/v2.0.1) || `v2` | outdated |
14+
| [v2.1](https://github.com/Sv443/JokeAPI/releases/tag/v2.1.5) || `v2` | outdated |
15+
| [v2.2](https://github.com/Sv443/JokeAPI/releases/tag/v2.2.1) || `v2` | active |
16+
17+
Location = subdomain or part of the URL path (eg. `/jokeapi/v2/` or `v2.jokeapi.dev`)

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ docs/documentation.html
2323
docs/compiled
2424

2525
# Joke submissions:
26+
data/submissions
27+
data/submissions/**
28+
data/submissions/*/**
2629
data/submissions/*/*.json
2730

2831
# Auth Tokens:

.vscode/launch.json

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,20 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"program": "${workspaceFolder}/tools/add-joke.js",
9-
"name": "Tools/xy",
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Debug JokeAPI",
11+
"skipFiles": [
12+
"<node_internals>/**"
13+
],
14+
"program": "${workspaceFolder}/JokeAPI.js",
15+
"args": [
16+
"--trace-deprecation"
17+
]
18+
},
19+
{
20+
"program": "${workspaceFolder}/tools/test.js",
21+
"name": "Unit Tests",
1022
"request": "launch",
1123
"type": "node",
1224
"skipFiles": [
@@ -18,16 +30,17 @@
1830
"console": "integratedTerminal"
1931
},
2032
{
21-
"type": "node",
33+
"program": "${workspaceFolder}/tools/submissions.js",
34+
"name": "Tools/xy",
2235
"request": "launch",
23-
"name": "Debug JokeAPI",
36+
"type": "node",
2437
"skipFiles": [
2538
"<node_internals>/**"
2639
],
27-
"program": "${workspaceFolder}/JokeAPI.js",
2840
"args": [
2941
"--trace-deprecation"
30-
]
42+
],
43+
"console": "externalTerminal"
3144
}
3245
],
3346
"debug.javascript.usePreview": true

.vscode/settings.json

Lines changed: 18 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"highlight.regexes": { // REQUIRES EXTENSION: fabiospampinato.vscode-highlight
3-
"(jsl\\.unused\\([a-zA-Z_,\\[\\]\\s]+\\);*)": [ // jsl.unused([some_var, some_other_var]);
3+
"(((jsl|scl)\\.)?unused\\([a-zA-Z_,\\[\\]\\s\\-\":.]+\\);*)": [ // jsl.unused([some_var, some_other_var]); or scl.unused(xy);
44
{
55
"backgroundColor": "rgba(0, 0, 0, 0.2)",
66
"color": "#f88"
@@ -14,7 +14,7 @@
1414
"overviewRulerColor": "#f41"
1515
}
1616
],
17-
"(#SECTION ([^\\S\\r\\n]*\\w+)*[:]*)": [ // #SECTION test
17+
"(#SECTION ([^\\S\\r\\n]*[\\w,.\\-_]+)*[:]*)": [ // #SECTION test, 123
1818
{
1919
"backgroundColor": "#44f",
2020
"color": "white",
@@ -27,52 +27,21 @@
2727
"color": "blue",
2828
"overviewRulerColor": "#ff0"
2929
}
30-
]
30+
],
31+
"(<!--%#INSERT:[a-zA-Z0-9\\-]+#%-->|<!--%#INJECT:[a-zA-Z0-9\\-]+#%-->)": [ // <!--%#INSERT:TEST#%--> / <!--%#INJECT:TEST#%-->
32+
{
33+
"color": "orange",
34+
"fontStyle": "italic",
35+
"outline": "1px solid orange"
36+
}
37+
],
3138
},
32-
// "highlight.regexes": { // REQUIRES EXTENSION: fabiospampinato.vscode-highlight
33-
// "(<!--%#INSERT:[a-zA-Z0-9\\-]+#%-->|<!--%#INJECT:[a-zA-Z0-9\\-]+#%-->)": [ // <!--%#INSERT:TEST#%--> / <!--%#INJECT:TEST#%-->
34-
// {
35-
// "color": "orange",
36-
// "fontStyle": "italic",
37-
// "outline": "1px solid orange"
38-
// }
39-
// ],
40-
// "(jsl\\.unused\\([a-zA-Z_\\\",\\[\\]\\s]+\\);*)": [ // jsl.unused([some_var, some_other_var]);
41-
// {
42-
// "backgroundColor": "rgba(0, 0, 0, 0.2)",
43-
// "color": "#f88"
44-
// }
45-
// ],
46-
// "(#MARKER)": [ //#MARKER test
47-
// {
48-
// "backgroundColor": "#f41",
49-
// "color": "#fff",
50-
// "isWholeLine": true,
51-
// "overviewRulerColor": "#f41"
52-
// }
53-
// ],
54-
// "(#SECTION [a-zA-Z0-9_-,]+)": [ //#SECTION test, foo bar
55-
// {
56-
// "backgroundColor": "#44f",
57-
// "color": "white",
58-
// "overviewRulerColor": "#44f"
59-
// }
60-
// ],
61-
// "(#DEBUG)": [ //#DEBUG
62-
// {
63-
// "backgroundColor": "#ff0",
64-
// "color": "blue",
65-
// "overviewRulerColor": "#ff0"
66-
// }
67-
// ],
68-
// "(?<!\\w)(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|rgba?\\s*\\([^)]*?\\)|hsla?\\s*\\([^)]*?\\)|aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyanaqua|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|tan|teal|thistle|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen)(?!\\w)": [
69-
// {
70-
// "rangeBehavior": 1,
71-
// "borderWidth": "1px",
72-
// "borderColor": "$1",
73-
// "borderStyle": "solid"
74-
// }
75-
// ]
76-
// },
77-
"npm-scripts.showStartNotification": false
39+
"npm-scripts.showStartNotification": false,
40+
41+
// JokeAPI-specific:
42+
43+
"files.exclude": { // hide files so they can't be opened in the IDE
44+
"docs/compiled": true, // to prevent accidentally changing the compiled documentation to only have it be overridden after the next compile
45+
"dev/madge": true, // the files don't need to be modified, they only serve as a distraction
46+
}
7847
}

JokeAPI.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// 🔹 JokeAPI by Sv443 🔹
22
//
33
// GitHub: https://github.com/Sv443/JokeAPI
4-
// API Docs: https://sv443.net/jokeapi/v2
4+
// API Docs: https://jokeapi.dev/
55
// ️
66
// ⚠️ Please read the LICENSE.txt file before modifying, redistributing or even selling JokeAPI.
77
// ⚠️ Thanks :)
@@ -17,7 +17,7 @@ function initJokeAPI()
1717
{
1818
if(settings.debug.verboseLogging)
1919
console.log("\n\n");
20-
debug("PreInit", "Called InitJokeAPI");
20+
debug("PreInit", `Initializing ${settings.info.name}`);
2121
// the debugger and child processes don't get along together so only wrap JokeAPI if the debugger is not active:
2222
if(!jsl.inDebugger() && !settings.wrapper.skipWrapping)
2323
return wrap(settings.wrapper.mainFilePath, settings.wrapper.wrapperSettings);

0 commit comments

Comments
 (0)