Add changes from stand-alone cic-meta repo.
This commit is contained in:
parent
34a48a6c6c
commit
8f65be16b1
1
apps/cic-meta/.gitignore
vendored
1
apps/cic-meta/.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
dist-web
|
dist-web
|
||||||
|
dist-server
|
||||||
scratch
|
scratch
|
||||||
tests
|
tests
|
||||||
|
@ -101,6 +101,18 @@ function parseDigest(url) {
|
|||||||
|
|
||||||
async function processRequest(req, res) {
|
async function processRequest(req, res) {
|
||||||
let digest = undefined;
|
let digest = undefined;
|
||||||
|
const headers = {
|
||||||
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
"Access-Control-Allow-Methods": "OPTIONS, POST, GET, PUT",
|
||||||
|
"Access-Control-Max-Age": 2592000, // 30 days
|
||||||
|
"Access-Control-Allow-Headers": 'Access-Control-Allow-Origin, Content-Type, x-cic-automerge'
|
||||||
|
};
|
||||||
|
|
||||||
|
if (req.method === "OPTIONS") {
|
||||||
|
res.writeHead(200, headers);
|
||||||
|
res.end();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!['PUT', 'GET', 'POST'].includes(req.method)) {
|
if (!['PUT', 'GET', 'POST'].includes(req.method)) {
|
||||||
res.writeHead(405, {"Content-Type": "text/plain"});
|
res.writeHead(405, {"Content-Type": "text/plain"});
|
||||||
@ -201,6 +213,7 @@ async function processRequest(req, res) {
|
|||||||
|
|
||||||
const responseContentLength = (new TextEncoder().encode(content)).length;
|
const responseContentLength = (new TextEncoder().encode(content)).length;
|
||||||
res.writeHead(200, {
|
res.writeHead(200, {
|
||||||
|
"Access-Control-Allow-Origin": "*",
|
||||||
"Content-Type": contentType,
|
"Content-Type": contentType,
|
||||||
"Content-Length": responseContentLength,
|
"Content-Length": responseContentLength,
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export { PGPSigner, PGPKeyStore } from './auth';
|
export { PGPSigner, PGPKeyStore, Signer } from './auth';
|
||||||
export { Envelope, Syncable } from './sync';
|
export { Envelope, Syncable } from './sync';
|
||||||
export { User } from './assets/user';
|
export { User } from './assets/user';
|
||||||
export { Phone } from './assets/phone';
|
export { Phone } from './assets/phone';
|
||||||
|
@ -93,7 +93,7 @@ function orderDict(src) {
|
|||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Syncable implements JSONSerializable, Authoritative {
|
class Syncable implements JSONSerializable, Authoritative, Signable {
|
||||||
|
|
||||||
id: string
|
id: string
|
||||||
timestamp: number
|
timestamp: number
|
||||||
|
Loading…
Reference in New Issue
Block a user