Giter Club home page Giter Club logo

api's People

Contributors

dromzeh avatar jktrn avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

api's Issues

Relocate site authentication into the API

Will (probably) relocate the current authentication on the site over to the API once all issues with setting cross origin cookies in lucia are fixed and their behaviour works as intended across all browsers - significantly easier in the long run to split the frontend/backend instead of a janky setup & can also allow for better ratelimiting by account and not per ip.

Could possibly allow for migrating db to CF D1 instead of Planetscale so everything is strictly CF (if D1 is out of alpha by then) but none of this is of high priority

add users to collections as "collaborators"

users should be able to invite others to collections as "collaborators" - where they can just remove or add assets

this can be done with a table collection_collaborators
contents of the table should be collection_id, user_id, date_added, accepted_invite [accepted, pending]

restructure routes & conform to zod-openapi spec

related to #51 - instead of routes being /v2/asset/upload-asset.ts, we can restructure like so:

/v2/asset/upload/route.ts (logic)
/v2/asset/upload/openapi.ts (openapi definition)
/v2/asset/upload/schema.ts (zod schema)

for routes which require an id or name, we can have /v2/user/get/[name]/route.ts, etc

create 128px image clones instead of CF image resizing

cf image resizing is expensive (pro: $9/50k) and hundreds of thousands of images are viewed/downloaded a day.

creating 128px clones of every image image-1.png => image-1-128px.png will significantly expedite asset display as all files are strongly cached in the R2 bucket as their content will likely never change

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/check.yml
  • actions/checkout v3
  • actions/setup-node v3
  • pnpm/action-setup v2
  • actions/checkout v3
  • actions/setup-node v3
  • pnpm/action-setup v2
  • actions/checkout v3
  • actions/setup-node v3
  • pnpm/action-setup v2
.github/workflows/deploy.yml
  • actions/checkout v3
  • actions/setup-node v3
  • pnpm/action-setup v2
  • cloudflare/wrangler-action 2.0.0
npm
package.json
  • @typescript-eslint/eslint-plugin ^7.0.2
  • itty-router ^4.0.27
  • prettier ^3.2.5
  • render2 ^1.4.1
  • @cloudflare/workers-types ^4.20240222.0
  • eslint ^8.57.0
  • eslint-config-google ^0.14.0
  • eslint-plugin-json ^3.1.0
  • typescript ^5.3.3
  • wrangler 3.29.0

  • Check this box to trigger a request for Renovate to run again on this repository

(v2) response headers not being set on openapi routes

all middleware is inconsistently invoking, middlewares control where we expect the following headers: Access-Control-Allow-Origin, Content-Length, Content-Type, access-control-allow-credentials, x-ratelimit-limit, x-ratelimit-policy, x-ratelimit-remaining, x-ratelimit-reset to be set.

however the API seems to inconsistently set Content-Length, Content-Type only.

i have no clue what is causing this at all,,,,,? can't wait to fix this

create authorization only endpoints

  • modify user attributes
  • saving [oc gen responses, assets]
  • make logout actually fucking work
  • upload pfp/banner endpoint to r2 bucket inside /avatars and /banners fire emoji

unintended behaviour: "full" location paths being stored in d1 game tables

/{game}/{asset} has been created as a new location within every games rows, while also still appending the requests value inside {asset} locations? Seems to be present within all backups from the past 16 hours.

I'm unsure on what's caused/causing this - doesn't affect the API's ability to sort assets by request popularity.

discord login provider

having the default credentials authentication is fine but giving user options to login thru different methods can make their life somewhat easier

if signing up through discord - attempt to set their username to their current discord username, if not available, has special characters (old system before pomelo) or what can be considered filtered text etc just randomly generate something (i.e merge name if clean && discrim) then is this is the case it can get passed back to onboarding redir

fix fucked typings

typings aren't correctly passed through routes because we aren't initializing hono correctly within routes [me issue] - and also why the ????!? im extending bindings as env with unknown???????????????????????????

add `@hono/zod-openapi` to existing codebase and routes

generates openapi documentation with type-safe params using zod for all routes; introduces type sharing between the frontend and backend, thus ensuring end-to-end type-safety for all routes && streamlining local development.

related to #43.

update d1 stuff

  • use experimental backend (+ metrics)
  • create table called requests, which will store this information, instead of having a table for each game and rows containing said data

link atlas files to spines ["sheets"]

this can probably be done with 2 new tables and new atlas directory in R2

  • atlas [id, r2 path, other metadata.. etc]
  • atlasToAsset [atlas.id <=> asset.id]

if asset category involves spines, we can check for linked atlas files then return it on /asset/[id]

could also create an atlas tag? [and/or atlasExists inside asset]

game "popularity" default sort

create totalAssetDownloadCount inside of games table, set to the amount of assets downloaded for each game, /games/all should sort by this col :3

robust db transactions on long queries

robust database transactions where appropriate guarantees the success of all queries within said transaction or nothing happens at all

drizzle provides APIs to handle transactions: https://orm.drizzle.team/docs/transactions, where all db queries can be wrapped like so:

await drizzle.transaction(async (trans) => {
    await trans.insert...
    await trans.delete....
})

better returned responses

response messages should be detailed, instead of something generic like error: "500: something went wrong" because for one that's just not very descriptive and we want to keep the API as lightweight as possible with no $$$s spent in unnecessary logging when stuff like wrangler tail literally exists

also, in the case of no entries returned for a specific users attributes, i.e saved oc generator responses, 200 should be returned with an empty array. 404 should ONLY be returned if user/specific whatever doesn't exist..

++ responses are very inconsistent rn

`lastUpdated` for each `game` & `asset` category

Append lastUpdated to:

  • each game in /games,
  • /games/:gameId & all subfolders listed
  • after asset in /games/:gameId:asset

Used to display Last updated: DD MM YYYY e.g Last updated: 3rd June 2023 for each asset category & each game, also useful for possible (game / category) sorting options in the future.

upgrade lucia to v3 (beta)

v3 is expected to release Q1 2024; considering the amount of breaking changes from v2 => v3 where oslo plays a big part alongside lucia, it makes more sense to migrate now to prevent significant issues later

implement new request form

authenticated users should be able to request assets/games/asset categories directly onto the site, with an upvoting system - similar to https://productlane.com/roadmap

entries should be approved by staff where all users can then vote on them, contributors & staff can mark as completed

this can be done with 2 tables
asset_request (request id, user id, title, created at, description)
asset_request_upvotes (request id, user id)

actually decent `/search/all` endpoint

query param which is passed should search for authUserName, gameName, assetCategoryName & tagName, If empty, return empty arr for each ""category"", indexing is a must

considering oc generators has like 8 objects, we can just index r2 bucket as it's stored /oc-generators/[game]
queries don't have to be exact, e.g "genshin" should return genshin-impact as entry in array game && oc-generator, complexity can be added in the future

allow users to "like" collections & assets

can just create 2 separate tables for this, with the following cols:

  • likedCollectionId & likedByUserId
  • likedAssetId & likedByUserId

for collections: check publicity & disable this feature if private, same with asset status is not approved ๐Ÿค”

site notifications & asset watching

w/ accounts, users will be able to set/recieve toggle-able notifications for the following:

++ "watch" for new game && assetcategory upload [e.g watch uploads for genshin impact character sheets] (has to be toggled by user)
++ site updates & planned maintenance (enabled by default if user gives notifs permissions)

also checks to prevent game && assetcategory watch notif spam if user(s) are mass uploading

planetscale -> turso migration

no more changing db, this is final - drizzle schema needs to be updated to sqlite
also need to re-implement asset data [which will need to be linked to a user] plus ALL endpoints
games and assetCategories will also be separate tables now, as well as tags per asset to support many [wanderer-moe/site#244]

seperate all routes into `/routes`

Move all game and oc-generator routes outside of routes.mjs into a /routes subfolder, for better clarity & readability.

  • Move /games, /game/:gameId & /game/:gameId/:asset into /routes/games
  • Move /oc-generators & /oc-generator/:gameId into /routes/oc-generator

`game` & `asset` "popularity" sorting

Implement popularity to each game & asset with a numerical value, the higher being the more popular.

This can be calculated from anonymized analytics from the site & CDN, therefore allowing for sorting by "user engagement".

This will be calculated using D1.

  • Implement storing & adding game & asset data
  • Collect game & game_asset data
  • Implement popularity sort, getting values for game asset & then appending popularity (1 = highest, etc)

Related to wanderer-moe/site#203 - makes sense to be implemented onto the API first.
Requires #5 to be completed beforehand

create class managers for repetitive queries

this will take in r2 & the drizzle (orm) instance, so instead of having to update multiple queries when they're reused, we can do stuff like:

user managing:
userManager.getUserById(user) userManager.getFollowers(user) userManager.followUser(user1, user2) userManager.updateUserAttributes(user, newAttributes) userManager.clearSesions(user)

asset managing:
assetManager.getAssetsFromQuery(tags[]?, assetCategories[]?, game[]?, uploadedBy[]?, name?)
assetManager.uploadAsset(assetData, tags[]?)

etc

update atlas link table for versatile file support

this is a more effective approach for connecting various files to assets in general, like fan-made .psd files - opposed to tables for each extension.

putting high priority (tbd asap) on this due to the nature of the change.

incorporate [en] pronouns.page API for users pronouns

had permission from one of the creators to do use their API for this (on the terms we use a custom UA for identification in-case of high request counts)

they have 2 very useful (& documented) endpoints: https://en.pronouns.page/api/pronouns & https://en.pronouns.page/api/pronouns/[pronoun] (i.e he/him) which can be strictly cached, contains useful data like pronunciations & morphemes & examples; i guess this can also be used for validation. fuck yeah i love inclusiveness********* ๐Ÿณ๏ธโ€โšง๏ธ๐Ÿ’ฏ๐Ÿ’ฏ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.