A local-first personal finance app
docs: add documentation on how to build the protobuf
Tom Frenchfda8127b4efb
diff --git a/packages/loot-core/src/server/sync/README.md b/packages/loot-core/src/server/sync/README.mdindex 0077e83d12..5df92100ca 100644--- a/packages/loot-core/src/server/sync/README.md+++ b/packages/loot-core/src/server/sync/README.md@@ -1,17 +1,29 @@+# protobuf++We use [protobuf](https://developers.google.com/protocol-buffers/) to encode messages as binary data to send across the network.+## Generating protobuf-We use protobuf to encode messages as binary data to send across the network.+The protobuf is generated by using the [protoc](https://github.com/protocolbuffers/protobuf) compiler.++This can be installed by downloading one of the [pre-built binaries](https://github.com/protocolbuffers/protobuf/releases/) and placing it in your `$PATH`. The version used to build the current protobuf is [v3.20.1](https://github.com/protocolbuffers/protobuf/releases/tag/v3.20.1).++Once installed, the protobuf can be generated by running the below commands.-To generate the protobuf: I forget, will document this soon.+```bash+cd packages/loot-core/src/server/sync++protoc sync.proto --js_out=import_style=commonjs,binary:proto+```However there is one very important thing to remember! The default output includes this near the top:```-var global = Function('return this')();+var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);```This will not work with our CSP directives. You must manually modify this to this:```var global = globalThis;-```\ No newline at end of file+```diff --git a/packages/loot-core/src/server/sync/proto/sync_pb.js b/packages/loot-core/src/server/sync/proto/sync_pb.jsindex f8100d4361..65bdc528b9 100644--- a/packages/loot-core/src/server/sync/proto/sync_pb.js+++ b/packages/loot-core/src/server/sync/proto/sync_pb.js@@ -2,11 +2,14 @@/*** @fileoverview* @enhanceable+ * @suppress {missingRequire} reports error on implicit type usages.* @suppress {messageConventions} JS Compiler reports an error if a variable or* field starts with 'MSG_' and isn't a translatable message.* @public*/// GENERATED CODE -- DO NOT EDIT!+/* eslint-disable */+// @ts-nocheckvar jspb = require('google-protobuf');var goog = jspb;