mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-24 23:56:51 +00:00
Share if preview is shown
This commit is contained in:
@@ -7,12 +7,12 @@ export const SHARE_KEY = 'share'
|
||||
|
||||
const ShareCache = new Map<string, string>()
|
||||
|
||||
export async function shareSnippet(type: string, version: VersionId, jsonData: any) {
|
||||
export async function shareSnippet(type: string, version: VersionId, jsonData: any, show_preview: boolean) {
|
||||
try {
|
||||
const data = lz.compressToBase64(JSON.stringify(jsonData))
|
||||
const raw = btoa(JSON.stringify(jsonData))
|
||||
console.log('Compression rate', raw.length / data.length)
|
||||
const body = JSON.stringify({ data, type, version })
|
||||
const body = JSON.stringify({ data, type, version, show_preview })
|
||||
let id = ShareCache.get(body)
|
||||
if (!id) {
|
||||
const snippet = await fetchApi('/snippets', body)
|
||||
|
||||
Reference in New Issue
Block a user