Charles Iliya Krempeaux 23914af3d2 | ||
---|---|---|
LICENSE | ||
README.md | ||
appendframe.go | ||
appendframe_test.go | ||
appendframeimage.go | ||
appendframeimage_test.go | ||
appendframeimageaspectratio.go | ||
appendframeimageaspectratio_test.go | ||
appendframeinputtext.go | ||
appendframeinputtext_test.go | ||
appendframeposturl.go | ||
appendframeposturl_test.go | ||
buffersize.go | ||
buttonactions.go | ||
stringframe.go | ||
stringframe_test.go | ||
stringframebutton1.go | ||
stringframebutton1_test.go | ||
stringframebutton2.go | ||
stringframebutton2_test.go | ||
stringframebutton3.go | ||
stringframebutton3_test.go | ||
stringframebutton4.go | ||
stringframebutton4_test.go | ||
stringframeimage.go | ||
stringframeimage_test.go | ||
stringframeimageaspectratio.go | ||
stringframeimageaspectratio_test.go | ||
stringframeinputtext.go | ||
stringframeinputtext_test.go | ||
stringframeposturl.go | ||
stringframeposturl_test.go | ||
stringmetapropertycontent.go | ||
stringmetapropertycontent_test.go | ||
versions.go | ||
writeframe.go | ||
writeframe_test.go | ||
writeframebutton1.go | ||
writeframebutton1_test.go | ||
writeframebutton1action.go | ||
writeframebutton1action_test.go | ||
writeframebutton1target.go | ||
writeframebutton1target_test.go | ||
writeframebutton2.go | ||
writeframebutton2_test.go | ||
writeframebutton2action.go | ||
writeframebutton2action_test.go | ||
writeframebutton2target.go | ||
writeframebutton2target_test.go | ||
writeframebutton3.go | ||
writeframebutton3_test.go | ||
writeframebutton3action.go | ||
writeframebutton3action_test.go | ||
writeframebutton3target.go | ||
writeframebutton3target_test.go | ||
writeframebutton4.go | ||
writeframebutton4_test.go | ||
writeframebutton4action.go | ||
writeframebutton4action_test.go | ||
writeframebutton4target.go | ||
writeframebutton4target_test.go | ||
writeframeimage.go | ||
writeframeimage_test.go | ||
writeframeimageaspectratio.go | ||
writeframeimageaspectratio_test.go | ||
writeframeinputtext.go | ||
writeframeinputtext_test.go | ||
writeframeposturl.go | ||
writeframeposturl_test.go | ||
writemetapropertycontent.go | ||
writemetapropertycontent_test.go |
README.md
go-frameproto
Package frameproto provides tools for the Frame Protocol — which is also known as Farcaster Frames, for the Go programming language.
Documention
Online documentation, which includes examples, can be found at: http://godoc.org/sourcecode.social/reiver/go-frameproto
Explanation
The Frames Protocol, also known Farcaster Frames, is a simple web-based technology used for making applications.
It uses HTML without really using HTML, so that Frames Protocol applications work with clients that don't support the Frames Protocol. The fall-back being OpenGraph.
Really, a Frames Protocol application is mostly made up of images and buttons on the client-side (that are specified using HTML <meta>
element) with a back-end that gets HTTP POST
ed to, which can return a new "page" with an image and buttons, and so on and so on.
This choice of just being mostly images and buttons actually makes the Frames Protocol simpler to create a viewer from scatch. No need to implement all Web technologies. No need to worry about security and privacy holes that Web technologies introduce.
Although the Frames Protocol could be used outside of Farcaster, at the time of writing, Farcaster clients (such as Warpcast) are the only major (client-side) platform to support it.
(The server-side of the Frames Protocol, which is called a Frame Server, is an just HTTP resource — which some might loosely call an HTTP (or HTTPS) URL.)
Enough talking — let's look at some code. Here is the client-side of a Frames Protocol application:
<meta property="fc:frame" content="vNext" />
<meta property="fc:frame:image" content="https://example.com/path/to/image.png" />
<meta property="og:image" content="https://example.com/path/to/image.png" />
It is just HTML.
Although this would need to be embedded into an HTML document, so really it would be something more like this:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8" />
<meta property="fc:frame" content="vNext" />
<meta property="fc:frame:image" content="https://example.com/path/to/image.png" />
<meta property="og:image" content="https://example.com/path/to/image.png" />
</head>
<body>
</body>
</html>
This package provides you tools for creating this.
For example:
func ServeHTTP(responseWriter http.ResponseWriter, request *http.Request) {
// ...
frameproto.WriteFrame(responseWriter, frameproto.VersionVNext)
frameproto.WriteFrameImage(responseWriter, frameImageURL)
// ...
}
Import
To import package frameproto use import
code like the follownig:
import "sourcecode.social/reiver/go-frameproto"
Installation
To install package frameproto do the following:
GOPROXY=direct go get https://sourcecode.social/reiver/go-frameproto
Author
Package frameproto was written by Charles Iliya Krempeaux