just finish it already

This commit is contained in:
Enstrayed
2025-06-13 22:59:07 -07:00
parent b4ecb63e43
commit cb289889d2
5 changed files with 207 additions and 22 deletions

View File

@@ -1,14 +1,11 @@
# Enstrayed API ## Note for Visitors
This repository contains the code for my personal web API written in JavaScript using the Express framework. * This README mainly contains information for operation but not usage. API documentation is available [here](https://enstrayed.com/posts/20240409-API-Documentation.html).
* Have feedback or experiencing a problem with an endpoint? Please [open a GitHub issue](https://github.com/Enstrayed/enstrayedapi/issues/new).
## Documentation * Security problem? [Open a ticket here](https://helpdesk.enstrayed.com/open.php) with the topic set as 'Responsible Disclosure'.
This file contains documentation relevant for development and deployment, but not necessarily usage. Information for all endpoints is available [on my website](https://enstrayed.com/posts/20240409-API-Documentation.html). * This code is unlicensed but I don't really care if you use parts of it (I don't know why you would though).
## Issues
If you would like to report a bug or security issue, please open a GitHub issue. If you are the operator of a service this application accesses, use the contact information provided during registration with your service to contact me directly.
## Configuration ## Configuration
TODO: Rewrite
<details> <summary>Configuration Template</summary> <details> <summary>Configuration Template</summary>
@@ -19,7 +16,7 @@ If you would like to report a bug or security issue, please open a GitHub issue.
</details> </details>
## Docker ## Docker
In production, this application is designed to be run in Docker, and the container built by pulling the latest commit from the main branch. As such, deploying this application is just a matter of creating a directory and copying the Dockerfile: TODO: Rewrite & add Komodo TOML files
```dockerfile ```dockerfile
FROM node:22 FROM node:22
@@ -39,6 +36,3 @@ ENTRYPOINT [ "node", "index.js" ]
``` ```
</details> </details>
## License
If for whatever reason you want to, you are free to adapt this code for your own projects or as reference. However, this software is provided as-is with no warranty or agreement to support it.

View File

@@ -7,7 +7,7 @@ import { marked } from "marked"
var timeSinceLastQuery = Date.now()-10000 var timeSinceLastQuery = Date.now()-10000
var cachedResult = "" var cachedResult = ""
app.get("/", (rreq, rres) => { app.get("/indexbeta", (rreq, rres) => {
if (Date.now() < timeSinceLastQuery+10000) { if (Date.now() < timeSinceLastQuery+10000) {
rres.send(cachedResult) rres.send(cachedResult)
} else { } else {
@@ -17,6 +17,10 @@ app.get("/", (rreq, rres) => {
} }
}) })
app.get("/", (rreq, rres) => {
rres.sendFile(process.cwd()+"/website/templates/construction.html")
})
app.get("/static/*", (rreq,rres) => { app.get("/static/*", (rreq,rres) => {
rres.sendFile(process.cwd()+"/website/static/"+rreq.url.replace("/static/","")) rres.sendFile(process.cwd()+"/website/static/"+rreq.url.replace("/static/",""))
}) })

View File

@@ -1,7 +0,0 @@
- [ ] GET /api/whoami - Returns owner of token and what scopes it has
- [ ] GET /api/login - OIDC login redirect to ECLS
- [ ] GET /api/callback - Creates new token that is intended to be local to browser; e.g. can be used in turn to make longer lasting more specific tokens
- [ ] POST /api/token - Allows owner to create a new token with customized scopes, comments & expiration date
- [ ] DELETE /api/token - Invalidate a token
- [ ] liberals/libnowplaying - Implement queryCider()
- [ ] routes/nowplaying - Reimplement query order to Cider and then Jellyfin

View File

@@ -0,0 +1,152 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_ii_18_12057)">
<path d="M3 9C3 8.44772 3.44772 8 4 8H28C28.5523 8 29 8.44772 29 9V20C29 20.5523 28.5523 21 28 21H4C3.44772 21 3 20.5523 3 20V9Z" fill="url(#paint0_linear_18_12057)"/>
</g>
<path d="M3 9C3 8.44772 3.44772 8 4 8H28C28.5523 8 29 8.44772 29 9V20C29 20.5523 28.5523 21 28 21H4C3.44772 21 3 20.5523 3 20V9Z" fill="url(#paint1_linear_18_12057)"/>
<path d="M3 9C3 8.44772 3.44772 8 4 8H28C28.5523 8 29 8.44772 29 9V20C29 20.5523 28.5523 21 28 21H4C3.44772 21 3 20.5523 3 20V9Z" fill="url(#paint2_radial_18_12057)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.4748 20.9999H19.525L29 11.5249V16.4746L24.4748 20.9999Z" fill="url(#paint3_linear_18_12057)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.4748 20.9999H19.525L29 11.5249V16.4746L24.4748 20.9999Z" fill="url(#paint4_linear_18_12057)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.4748 20.9999H19.525L29 11.5249V16.4746L24.4748 20.9999Z" fill="url(#paint5_linear_18_12057)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.4748 21H9.52502L22.525 8H27.4748L14.4748 21Z" fill="url(#paint6_linear_18_12057)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.4748 21H9.52502L22.525 8H27.4748L14.4748 21Z" fill="url(#paint7_linear_18_12057)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.4748 21H9.52502L22.525 8H27.4748L14.4748 21Z" fill="url(#paint8_linear_18_12057)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.47476 21H4C3.44772 21 3 20.5523 3 20V17.525L12.525 8H17.4748L4.47476 21Z" fill="url(#paint9_linear_18_12057)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.47476 21H4C3.44772 21 3 20.5523 3 20V17.525L12.525 8H17.4748L4.47476 21Z" fill="url(#paint10_linear_18_12057)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.47476 21H4C3.44772 21 3 20.5523 3 20V17.525L12.525 8H17.4748L4.47476 21Z" fill="url(#paint11_linear_18_12057)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.47476 21H4C3.44772 21 3 20.5523 3 20V17.525L12.525 8H17.4748L4.47476 21Z" fill="url(#paint12_linear_18_12057)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.47476 8H4C3.44772 8 3 8.44772 3 9V12.4748L7.47476 8Z" fill="url(#paint13_linear_18_12057)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.47476 8H4C3.44772 8 3 8.44772 3 9V12.4748L7.47476 8Z" fill="url(#paint14_linear_18_12057)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.47476 8H4C3.44772 8 3 8.44772 3 9V12.4748L7.47476 8Z" fill="url(#paint15_linear_18_12057)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M26 21H24V30H26V21Z" fill="url(#paint16_linear_18_12057)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M26 21H24V30H26V21Z" fill="url(#paint17_radial_18_12057)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 21H6V30H8V21Z" fill="url(#paint18_linear_18_12057)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 21H6V30H8V21Z" fill="url(#paint19_radial_18_12057)"/>
<path d="M6 7.5C6 6.67157 6.67157 6 7.5 6C8.32843 6 9 6.67157 9 7.5V8H6V7.5Z" fill="url(#paint20_linear_18_12057)"/>
<path d="M23 7.5C23 6.67157 23.6716 6 24.5 6C25.3284 6 26 6.67157 26 7.5V8H23V7.5Z" fill="url(#paint21_linear_18_12057)"/>
<g filter="url(#filter1_f_18_12057)">
<rect x="7.10938" y="21.5" width="0.47476" height="8" rx="0.23738" fill="#DFD0E9"/>
</g>
<g filter="url(#filter2_f_18_12057)">
<rect x="25" y="21.5" width="0.47476" height="8" rx="0.23738" fill="#DFD0E9"/>
</g>
<defs>
<filter id="filter0_ii_18_12057" x="2.5" y="7.5" width="27" height="14" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dx="0.5" dy="-0.5"/>
<feGaussianBlur stdDeviation="0.375"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.831373 0 0 0 0 0.494118 0 0 0 0 0.282353 0 0 0 1 0"/>
<feBlend mode="normal" in2="shape" result="effect1_innerShadow_18_12057"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dx="-0.5" dy="0.5"/>
<feGaussianBlur stdDeviation="0.375"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 0.415686 0 0 0 1 0"/>
<feBlend mode="normal" in2="effect1_innerShadow_18_12057" result="effect2_innerShadow_18_12057"/>
</filter>
<filter id="filter1_f_18_12057" x="6.45938" y="20.85" width="1.77473" height="9.3" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feGaussianBlur stdDeviation="0.325" result="effect1_foregroundBlur_18_12057"/>
</filter>
<filter id="filter2_f_18_12057" x="24.35" y="20.85" width="1.77473" height="9.3" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feGaussianBlur stdDeviation="0.325" result="effect1_foregroundBlur_18_12057"/>
</filter>
<linearGradient id="paint0_linear_18_12057" x1="25.8457" y1="9.98514" x2="8.5" y2="18.625" gradientUnits="userSpaceOnUse">
<stop stop-color="#F7D142"/>
<stop offset="1" stop-color="#FCB545"/>
</linearGradient>
<linearGradient id="paint1_linear_18_12057" x1="3" y1="14.0109" x2="3.79" y2="14.0109" gradientUnits="userSpaceOnUse">
<stop stop-color="#A57C4B"/>
<stop offset="1" stop-color="#A57C4B" stop-opacity="0"/>
</linearGradient>
<radialGradient id="paint2_radial_18_12057" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(4.68831 8) scale(12.0629 1.90436)">
<stop offset="0.135638" stop-color="#FBBC43"/>
<stop offset="1" stop-color="#FBBC43" stop-opacity="0"/>
</radialGradient>
<linearGradient id="paint3_linear_18_12057" x1="27.6071" y1="11.5249" x2="18.4096" y2="17.9823" gradientUnits="userSpaceOnUse">
<stop stop-color="#353138"/>
<stop offset="1" stop-color="#503B62"/>
</linearGradient>
<linearGradient id="paint4_linear_18_12057" x1="22.0781" y1="20.9999" x2="22.0781" y2="20.3116" gradientUnits="userSpaceOnUse">
<stop stop-color="#4B2867"/>
<stop offset="1" stop-color="#4B2867" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint5_linear_18_12057" x1="29" y1="14.4905" x2="25.7434" y2="14.4905" gradientUnits="userSpaceOnUse">
<stop stop-color="#353139"/>
<stop offset="0.166461" stop-color="#413D46"/>
<stop offset="0.455618" stop-color="#413D46" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint6_linear_18_12057" x1="24.836" y1="8" x2="11.4256" y2="21" gradientUnits="userSpaceOnUse">
<stop stop-color="#353138"/>
<stop offset="1" stop-color="#503B62"/>
</linearGradient>
<linearGradient id="paint7_linear_18_12057" x1="14.3616" y1="21" x2="14.3616" y2="20.0557" gradientUnits="userSpaceOnUse">
<stop stop-color="#4B2867"/>
<stop offset="1" stop-color="#4B2867" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint8_linear_18_12057" x1="23.3427" y1="8" x2="23.3427" y2="12.0689" gradientUnits="userSpaceOnUse">
<stop stop-color="#353139"/>
<stop offset="0.166461" stop-color="#413D46"/>
<stop offset="0.422206" stop-color="#413D46" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint9_linear_18_12057" x1="15.3468" y1="8" x2="2.32672" y2="18.1782" gradientUnits="userSpaceOnUse">
<stop stop-color="#353138"/>
<stop offset="1" stop-color="#503B62"/>
</linearGradient>
<linearGradient id="paint10_linear_18_12057" x1="6.90025" y1="21" x2="6.90025" y2="20.0557" gradientUnits="userSpaceOnUse">
<stop stop-color="#4B2867"/>
<stop offset="1" stop-color="#4B2867" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint11_linear_18_12057" x1="14.1427" y1="8" x2="14.1427" y2="12.0689" gradientUnits="userSpaceOnUse">
<stop stop-color="#353139"/>
<stop offset="0.166461" stop-color="#413D46"/>
<stop offset="0.422206" stop-color="#413D46" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint12_linear_18_12057" x1="3" y1="15.1145" x2="3.75" y2="15.1145" gradientUnits="userSpaceOnUse">
<stop stop-color="#2F2C32"/>
<stop offset="1" stop-color="#2F2C32" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint13_linear_18_12057" x1="6.81693" y1="8" x2="2.47324" y2="11.0496" gradientUnits="userSpaceOnUse">
<stop stop-color="#353138"/>
<stop offset="1" stop-color="#503B62"/>
</linearGradient>
<linearGradient id="paint14_linear_18_12057" x1="6.44467" y1="8" x2="6.44467" y2="9.40056" gradientUnits="userSpaceOnUse">
<stop stop-color="#353139"/>
<stop offset="0.166461" stop-color="#413D46"/>
<stop offset="0.422206" stop-color="#413D46" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint15_linear_18_12057" x1="3" y1="10.4489" x2="4" y2="10.4489" gradientUnits="userSpaceOnUse">
<stop stop-color="#2F2C32"/>
<stop offset="1" stop-color="#2F2C32" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint16_linear_18_12057" x1="24" y1="23.9375" x2="25" y2="23.9375" gradientUnits="userSpaceOnUse">
<stop stop-color="#857C8C"/>
<stop offset="1" stop-color="#B9A7C4"/>
</linearGradient>
<radialGradient id="paint17_radial_18_12057" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(25 29.5937) rotate(-90) scale(8.79687 5.25369)">
<stop offset="0.912727" stop-color="#7E5E91" stop-opacity="0"/>
<stop offset="0.992895" stop-color="#7E5E91"/>
</radialGradient>
<linearGradient id="paint18_linear_18_12057" x1="6" y1="23.9375" x2="7" y2="23.9375" gradientUnits="userSpaceOnUse">
<stop stop-color="#857C8C"/>
<stop offset="1" stop-color="#B9A7C4"/>
</linearGradient>
<radialGradient id="paint19_radial_18_12057" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(7 29.5937) rotate(-90) scale(8.79687 5.25369)">
<stop offset="0.912727" stop-color="#7E5E91" stop-opacity="0"/>
<stop offset="0.992895" stop-color="#7E5E91"/>
</radialGradient>
<linearGradient id="paint20_linear_18_12057" x1="7.5" y1="6" x2="7.5" y2="8" gradientUnits="userSpaceOnUse">
<stop offset="0.5625" stop-color="#CB1E72"/>
<stop offset="1" stop-color="#E61C31"/>
</linearGradient>
<linearGradient id="paint21_linear_18_12057" x1="24.5" y1="6" x2="24.5" y2="8" gradientUnits="userSpaceOnUse">
<stop offset="0.5625" stop-color="#CB1E72"/>
<stop offset="1" stop-color="#E61C31"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Under Construction</title>
<style>
html {
height: 75%;
}
body {
margin: 0;
display: grid;
place-items: center;
height: 100%;
color: #fff;
background-color: #0b0b0b;
}
body > div {
margin-left: 2em;
margin-right: 2em;
}
a, a:hover {
color: #fff;
text-decoration: underline;
}
</style>
</head>
<body>
<div>
<img src="/static/construction.svg" alt="Construction Icon" width="64">
<h1>Under Construction</h1>
<p>
This page is undergoing a revamp and will be available again soon.<br>
All API endpoints are still available. Documentation is available <a href="/posts/20240409-API-Documentation.html">here</a>.
</p>
</div>
</body>
</html>