403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.133.122.6
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/thread-self/root/proc/7779/cwd/plugins/code-snippets/js/utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/thread-self/root/proc/7779/cwd/plugins/code-snippets/js/utils/files.ts
import { getSnippetType } from './snippets'
import type { Snippet } from '../types/Snippet'

const SECOND_IN_MS = 1000
const TIMEOUT_SECONDS = 40

const MIME_INFO = <const> {
	php: ['php', 'text/php'],
	html: ['php', 'text/php'],
	css: ['css', 'text/css'],
	js: ['js', 'text/javascript'],
	json: ['json', 'application/json']
}

export const downloadAsFile = (content: BlobPart, filename: string, type: string) => {
	const link = document.createElement('a')
	link.download = filename
	link.href = URL.createObjectURL(new Blob([content], { type }))

	setTimeout(() => URL.revokeObjectURL(link.href), TIMEOUT_SECONDS * SECOND_IN_MS)
	setTimeout(() => link.click(), 0)
}

export const downloadSnippetExportFile = (
	content: BlobPart,
	{ id, name, scope }: Snippet,
	type?: keyof typeof MIME_INFO
) => {
	const [ext, mimeType] = MIME_INFO[type ?? getSnippetType(scope)]

	const sanitizedName = name.toLowerCase().replace(/[^\w-]+/g, '-').trim()

	const title = '' === sanitizedName ? `snippet-${id}` : sanitizedName
	const filename = `${title}.code-snippets.${ext}`

	downloadAsFile(content, filename, mimeType)
}

Youez - 2016 - github.com/yon3zu
LinuXploit