5 Commits 1ff0a6f75e ... 2464b0e14c

Author SHA1 Message Date
  Sv443 2464b0e14c ref: correct extension for type-export-only files 1 month ago
  Sv443 9d359667bb fix: replace substr with substring 1 month ago
  Sv443 e7e757229f chore: bump version to 2.3.3 1 month ago
  Sv443 8201b416c4 feat: current year 1 month ago
  Sv443 3f74270055 docs: reword some stuff 1 month ago

+ 1 - 1
LICENSE.txt

@@ -1,6 +1,6 @@
 MIT License
 
-Copyright (c) 2018-2021 Sven Fehler & The Sv443 Network
+Copyright (c) 2018-2025 Sven Fehler & The Sv443 Network
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal

+ 4 - 4
docs/raw/index.html

@@ -122,7 +122,7 @@
                 If you enjoy using <!--%#INSERT:NAME#%--> and want to support the development, please consider donating <a href="https://github.com/sponsors/Sv443" target="_blank">here ♥</a><br>
                 <br>
                 I can't speak all languages, so please note that I can't ensure format and validity of jokes that aren't in English or German.<br>
-                If you do come across an invalid joke or a joke that is formatted incorrectly, please consider <a href="<!--%#INSERT:PROJGITHUBURL#%-->/issues/new?assignees=Sv443&labels=reported+joke&template=3_report_a_joke.md&title=" target="_blank">opening an issue</a> or <a href="<!--%#INSERT:PROJGITHUBURL#%-->/blob/master/.github/Contributing.md#submitting-or-editing-jokes" target="_blank">submitting a pull request.</a><br>
+                If you do come across an invalid joke or a joke that is formatted or categorized incorrectly, please consider <a href="<!--%#INSERT:PROJGITHUBURL#%-->/issues/new?assignees=Sv443&labels=reported+joke&template=3_report_a_joke.md&title=" target="_blank">opening an issue</a> or <a href="<!--%#INSERT:PROJGITHUBURL#%-->/blob/master/.github/Contributing.md#submitting-or-editing-jokes" target="_blank">submitting a pull request.</a><br>
 
                 <br>
 
@@ -159,14 +159,14 @@
                 <div class="docHeader targetBlink" id="news"><a class="headerAnchorContainer" href="#news" title="Click to link to this header">🔗</a><span class="docHeaderText">News:</span></div>
                 <ul id="newsList">
                     <li>
-                        <b><!--%#INSERT:NAME#%--> now has its own domain!</b><br>
+                        <b><!--%#INSERT:NAME#%--> has its own domain!</b><br>
                         You can now replace the base URL <mark>https://sv443.net/jokeapi/v2</mark> with <mark>https://v2.jokeapi.dev/</mark><br>
                         Note: you should always use the <mark>v2</mark> subdomain to call the API but you can omit it if you just want to view the documentation.<br>
                         For backwards compatibility the old URL will still be usable until version 2 will be deprecated.
                     </li>
                     <li>
                         <b>Is <!--%#INSERT:NAME#%--> serving too many offensive jokes?</b><br>
-                        Try using version 2.3.0's new <a href="#safe-mode">safe mode</a> and the <a href="#blacklist-flags">explicit flag.</a>
+                        Try using version 2.3.0's <a href="#safe-mode">safe mode</a> and the <a href="#blacklist-flags">explicit language flag.</a>
                     </li>
                 </ul>
 
@@ -1691,7 +1691,7 @@ namespace TestHttpRequest
                 <br><br><br><br>
     
                 <footer id="copyrightNotice">
-                    <span>&copy; Copyright 2018-2021 Sv443 - licensed under the <a href="https://sv443.net/LICENSE" target="_blank">MIT license</a></span><br>
+                    <span>&copy; Copyright 2018-<span class="insert-current-year">2025</span> Sv443 - licensed under the <a href="https://sv443.net/LICENSE" target="_blank">MIT license</a></span><br>
                     <span>This project is a part of the <a href="https://sv443.net/" target="_blank">Sv443 Network</a></span>
                 </footer>
             </main>

+ 4 - 1
docs/raw/index.js

@@ -18,7 +18,7 @@ var submission = {};
 
 if(settings.baseURL.endsWith("/"))
 {
-    settings.baseURL = settings.baseURL.substr(0, (settings.baseURL.length - 1));
+    settings.baseURL = settings.baseURL.substring(0, (settings.baseURL.length - 1));
 }
 
 var tryItOk = false;
@@ -173,6 +173,9 @@ function onLoad()
         clearOnInitElems[j].value = "";
     }
 
+    // insert dates
+    document.querySelectorAll(".insert-current-year").forEach((e) => e.innerText = new Date().getFullYear());
+
     try
     {
         var fileFormats = JSON.parse('<!--%#INSERT:FILEFORMATARRAY#%-->');

+ 1 - 1
package-lock.json

@@ -1,6 +1,6 @@
 {
   "name": "@sv443/jokeapi",
-  "version": "2.3.2",
+  "version": "2.3.3",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@sv443/jokeapi",
-  "version": "2.3.2",
+  "version": "2.3.3",
   "description": "A REST API that serves jokes from many categories while also offering a lot of filtering methods",
   "main": "JokeAPI.js",
   "homepage": "https://v2.jokeapi.dev",

+ 2 - 2
src/httpServer.js

@@ -121,7 +121,7 @@ const init = () => {
                     analytics({
                         type: "Error",
                         data: {
-                            errorMessage: `Error while setting up the HTTP response to "${ip.substr(8)}...": ${err}`,
+                            errorMessage: `Error while setting up the HTTP response to "${ip.substring(8)}...": ${err}`,
                             ipAddress: ip,
                             urlParameters: parsedURL.queryParams,
                             urlPath: parsedURL.pathArray
@@ -386,7 +386,7 @@ const init = () => {
                                     "message": `Restarting ${settings.info.name}`,
                                     "timestamp": new Date().getTime()
                                 }, lang));
-                                console.log(`\n\n[${logger.getTimestamp(" | ")}]  ${jsl.colors.fg.red}IP ${jsl.colors.fg.yellow}${ip.substr(0, 8)}[...]${jsl.colors.fg.red} sent a restart command\n\n\n${jsl.colors.rst}`);
+                                console.log(`\n\n[${logger.getTimestamp(" | ")}]  ${jsl.colors.fg.red}IP ${jsl.colors.fg.yellow}${ip.substring(0, 8)}[...]${jsl.colors.fg.red} sent a restart command\n\n\n${jsl.colors.rst}`);
                                 process.exit(2); // if the process is exited with status 2, the package node-wrap will restart the process
                             }
                             else return respondWithErrorPage(res, 400, tr(lang, "invalidSubmissionOrWrongEndpoint", (parsedURL.pathArray != null ? parsedURL.pathArray[0] : "/")));

+ 1 - 1
src/languages.js

@@ -130,7 +130,7 @@ function jokeLangs()
         if(f == settings.jokes.jokesTemplateFile)
             return;
 
-        let langCode = f.split("-")[1].substr(0, 2);
+        let langCode = f.split("-")[1].substring(0, 2);
 
         retLangs.push({
             code: langCode,

+ 1 - 1
src/parseURL.js

@@ -42,7 +42,7 @@ function parseURL(url)
         let rawQstr = (parsed.query == "" ? null : parsed.query);
 
         if(rawQstr && rawQstr.startsWith("?"))
-            rawQstr = rawQstr.substr(1);
+            rawQstr = rawQstr.substring(1);
 
         if(!jsl.isEmpty(rawQstr) && rawQstr.includes("&"))
             qstrArr = rawQstr.split("&");

+ 0 - 0
src/types/env.d.ts → src/types/env.ts


+ 0 - 0
src/types/jokes.d.ts → src/types/jokes.ts


+ 0 - 0
src/types/languages.d.ts → src/types/languages.ts


+ 1 - 1
tools/add-joke.js

@@ -157,7 +157,7 @@ function promptJoke(currentJoke)
                 const truncateLength = 64;
                 
                 if(typeof curProp === "string" && curProp.length > truncateLength)
-                    curProp = `${curProp.substr(0, truncateLength)}…`;
+                    curProp = `${curProp.substring(0, truncateLength)}…`;
 
                 const boolDeco = typeof curProp === "boolean" ? (curProp === true ? ` ${col.green}✔ ` : ` ${col.red}✘ `) : "";
 

+ 2 - 2
tools/submissions.js

@@ -727,9 +727,9 @@ function getSubmissions(lang)
 function parseFileName(fileName)
 {
     if(fileName.startsWith("submission_"))
-        fileName = fileName.substr(11);
+        fileName = fileName.substring(11);
     if(fileName.endsWith(".json"))
-        fileName = fileName.substr(0, fileName.length - 5);
+        fileName = fileName.substring(0, fileName.length - 5);
 
     // eff8e7ca_0_1634205492859
 

+ 2 - 2
tools/validate-ids.js

@@ -30,7 +30,7 @@ try
         if(fName.startsWith("template"))
             return;
 
-        let langCode = fName.split("-")[1].substr(0, 2);
+        let langCode = fName.split("-")[1].substring(0, 2);
 
         let filePath = resolve(join(settings.jokes.jokesFolderPath, fName));
 
@@ -62,7 +62,7 @@ try
                     jokeContent = `${errjoke.joke.setup.replace(/\n/gm, "\\n")} -/- ${errjoke.joke.delivery.replace(/\n/gm, "\\n")}`;
 
                 if(jokeContent.length > 40)
-                    jokeContent = `${jokeContent.substr(0, 40)}...`;
+                    jokeContent = `${jokeContent.substring(0, 40)}...`;
 
                 console.log(`#${errjoke.joke.id} | ${langCode} | ${errjoke.joke.category} | ${jokeContent}    ${col.red}(Expected ID #${errjoke.idx} - joke instead has #${errjoke.joke.id})${col.rst}`);
                 notOk++;