···1313 - go mod tidy
14141515builds:
1616- - main: ./cmd/postcards
1616+ -
1717+ main: ./cmd/postcards
1718 id: postcards
1819 binary: postcards
1920 env:
···2930 - wasm
3031 ldflags:
3132 - -s -w -X "main.Date={{.CommitDate}}"
3232-universal_binaries:
3333- - name_template: postcards
3434- id: mac-universal
3535- replace: true
3333+ -
3434+ main: ./cmd/postoffice-serviceworker
3535+ id: postoffice-serviceworker
3636+ binary: postoffice-serviceworker
3737+ env:
3838+ - CGO_ENABLED=0
3939+ goos:
4040+ - js
4141+ goarch:
4242+ - wasm
4343+ # It's important the postoffice native binary is built after the WASM blob
4444+ # As the WASM blob is baked into this server as part of an embed directive
4545+ -
4646+ main: ./cmd/postoffice
4747+ id: postoffice
4848+ binary: postoffice
4949+ env:
5050+ - CGO_ENABLED=0
5151+ goos:
5252+ - linux
5353+ - windows
5454+ - darwin
5555+ - wasip1
5656+ goarch:
5757+ - amd64
5858+ - arm64
5959+ - wasm
36603761archives:
3862 - format: tar.gz
+1
TODO.md
···1717- [ ] Don't re-encode same-same format. (eg. USDZ to Web(no alpha, lossy); Web to Web)
1818- [ ] Show warning when using fallback size to generate USDZ
1919- [ ] Show warning when losing information on conversion (are there any of these cases now?)
2020+- [ ] Get HTML format to output the _right_ image extension (perhaps provide argument for what to add into templates?)
20212122## Done
2223
···11+package types
22+33+import (
44+ "fmt"
55+)
66+77+func (pc Postcard) Validate() error {
88+ switch pc.Sides() {
99+ case 0:
1010+ return fmt.Errorf("a postcard must have at least a front side")
1111+ case 1:
1212+ if pc.Meta.Flip != FlipNone {
1313+ return fmt.Errorf("flip of '%s' given, but only 1 side provided", pc.Meta.Flip)
1414+ }
1515+ case 2:
1616+ if pc.Meta.Flip == FlipNone || !pc.Meta.Flip.IsValid() {
1717+ return fmt.Errorf("invalid flip type '%s' for two-sided postcard", pc.Meta.Flip)
1818+ }
1919+ }
2020+2121+ return nil
2222+}