Add customizer support for OpenSCAD
This also includes sending metadata and part of the concatenated gzip, not in the s3 metadata as that has a 2kb limit. Resolves #320
This commit is contained in:
@@ -13,8 +13,8 @@ export const stlToGeometry = (url) =>
|
||||
|
||||
export interface RenderArgs {
|
||||
code: State['code']
|
||||
parameters?: RawCustomizerParams
|
||||
settings: {
|
||||
parameters?: RawCustomizerParams
|
||||
camera: State['camera']
|
||||
viewerSize: State['viewerSize']
|
||||
quality: State['objectData']['quality']
|
||||
@@ -103,3 +103,16 @@ export type RenderResponse = HealthyResponse | ErrorResponse
|
||||
export interface DefaultKernelExport {
|
||||
render: (arg: RenderArgs) => Promise<RenderResponse>
|
||||
}
|
||||
|
||||
export const splitGziped = (text: string) => {
|
||||
const concatSplitStr = 'cadhub-concat-split'
|
||||
const splitIndex = text.indexOf(concatSplitStr)
|
||||
const json = text.slice(splitIndex + concatSplitStr.length)
|
||||
|
||||
try {
|
||||
return JSON.parse(json)
|
||||
} catch (e) {
|
||||
console.log(json, e)
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user