BetterTwitFix icon indicating copy to clipboard operation
BetterTwitFix copied to clipboard

Refactor code and VNF objects

Open dylanpdx opened this issue 1 year ago • 0 comments

I'd like to do some major refactoring and generally improve code readability, then lead into #20

  • [ ] New VNF object I'm looking at redesigning the VNF objects, mainly to support multi media uploads & newer twitter fields Currently I have something like this in mind
{
	"id": 12345,
	"text": "this is the tweet body",
	"media": [
		{
			"url": "https://pbs.twimg.com/media/aaaaaaa.jpg",
			"type": "image",
			"size": {
				"width": 1,
				"height": 1
			}
		},
		{
			"url": "https://pbs.twimg.com/media/xxxxxxx.mp4",
			"type": "video",
			"size": {
				"width": 1,
				"height": 1
			}
		},
		{
			"url": "https://pbs.twimg.com/media/yyyyy.gif",
			"type": "gif",
			"size": {
				"width": 1,
				"height": 1
			}
		}
	],
	"likes": 123,
	"nsfw": false,
	"pfp": "url",
	"qrtURL": null,
	"rts": 456,
	"views": 789,
	"replies": 555,
	"screen_name": "user",
	"time": "2023-07-06T12:26:39.000Z",
	"ttl": 1688800953,
	"uploaderName": "User",
	"verified": false,
	"poll": null
}

Possibly an "edited" field will be needed as well. This will allow for embeds consisting of all one type (i.e all images) to be combined, and embeds of mixed types to support a /1, /2, /3, or /4 path

  • [ ] General code refactoring Code in general needs to be cleaned up. The cache/twExtract stuff was a good start but a lot is still a mess (my fault!) Templates specifically could use some rewrites to only take in the VNF object and use that in the template HTML

  • [ ] Other misc. things to consider

  • Removing the Cache system: NGINX Content Caching or CloudFront/CloudFlare can be used for this. This makes setup more of a pain, however

  • Remove user agent check: Again, could probably be handled by NGINX or CloudFlare, but improves setup complexity.

  • Embed changes: Moving around which fields display where in an embed. Only issue is Video embeds which don't show description in Discord

  • Separating README into separate pages (or a wiki?)

Tests using VNF objects will probably have to be changed

dylanpdx avatar Jul 08 '23 22:07 dylanpdx