thombruce / tnt

Thom's Nuxt Template
https://tnt.thombruce.com/
MIT License
0 stars 0 forks source link

[Feature]: Enable support for content submissions #7

Open thombruce opened 11 months ago

thombruce commented 11 months ago

Feature request

This is largely in regards to thombruce/thedefinitiveedition - I eventually would like to be able to feature user-submitted content there, and this should be supported within the website itself.

Lack of user accounts does mean that anybody could pose as anybody else at any time... and people might:

  1. Want to put their names to their writing/recommendations
  2. Wish to avoid being impersonated

I can personally manage this on my own sites at a small scale via community tools like Discord, but... I can't do this at scale or for others.

There isn't exactly a way, I don't think, to pass secrets from form content to GitHub... so that's out of the question.

Again, like #6, this might call for a custom CMS or backend that supports user authentication ahead of any content submission request being made - users would be signed in via said service and the service would be responsible for verifying their identity ahead of submitting a PR with the content to GitHub.

We could still support anonymous or unverified submissions too, but the backend service would be a means by which we could correctly tag articles submitted by the same author.

That's very out of scope here and now. As a starting point: Anonymous/unverified submissions will do. We can enable users to attach their name and a link to their personal website or socials.


Further consideration: One of copyright. This applies to comments too, but I believe we need clear terms wrt publishing rights whenever anyone makes a submission.

This, again, can be handled more easily with a dedicated backend. But it occurs to me... we can make a very easy start on this by just adding a GitHub issue template, since I already have contributors agreeing to our code of conduct and contribution policies there - I may need to review those, but I can tailor the submission form to support articles submitted as issues. I'd just then have to translate those into markdown documents... so, still prefer to achieve this with a sleeker interface that results in a PR.

Code of Conduct

thombruce commented 11 months ago

How I've handled this on The Definitive Edition is to create a form (TNT since has added a bunch of form components that are easily switched to, with the exception of Combobox which appears to have some issues). I've hooked this form up to a self-hosted Staticman instance that will submit the contribution to a Git repository.

Staticman requires its own config file in the receiving repository, so there's no adding it as a configurable within TNT.

Alternatives?

In both of those cases, the logic would need to live locally on the downstream repository.

An extendable/overwritable Nuxt server route could absolutely be included with TNT, with options to configure it for use with a Git provider or any other backend.

One thing I do know, having worked with Netlify serverless functions, is that we might be lacking a storage mechanism should any third-party providers require refreshable token-based auth. Vercel actually do provide some storage solutions, I believe.

It would be great if we could move the Netlify serverless function already written on The Definitive Edition into a Nuxt server route, and have this be useable by either of Netlify or Vercel or whatever other hosting service permits server-side functions.

This would allow us to bake in support for whatever third-party integrations require server side authentication, inclusive of GitHub, IGDB, APILayer, Cloudinary, etc.

Let's begin researching here whether it is even possible to integrate Nuxt server router with Netlify serverless functions and/or Vercel's equivalent.

thombruce commented 11 months ago

The Netlify Docs suggest that some SSR functionality of Nuxt can be auto-detected and should just work: https://docs.netlify.com/integrations/frameworks/nuxt/

Vercel also explicitly declare support for Nuxt server functions. See "Edge Functions" and "Serverless Functions" here: https://vercel.com/docs/frameworks/nuxt

thombruce commented 11 months ago

The integration I have at the moment on The Definitive Edition is a straightforward Netlify serverless function that connects with IGDB to retrieve a list of games matching a given query.

What I'll probably do as a starting point is to convert that into a Nuxt server/ route and try to get it hooked up using Netlify's serverless functions. Then we'll have a basic operational example to work from.

Serverless functions could be used to support...

* Snipcart comes to mind for handling this, however, and should probably be considered as an integration much like Umami and Cusdis. In fact, there is an official Snipcart Nuxt module: https://snipcart.nuxtjs.org/