This repository has been archived on 2026-09-04. You can view files and clone it. You cannot open issues or pull requests or push a commit.
2026-08-27 20:13:42 +08:00
|
|
|
export function languageLabel(filename: string) {
|
|
|
|
|
const extension = filename.split('.').pop()?.toUpperCase()
|
|
|
|
|
return extension && extension.length <= 6 ? extension : 'TEXT'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rawSnippetUrl(id: string) {
|
2026-08-27 21:05:25 +08:00
|
|
|
return `https://snippets.rtast.cn/${encodeURIComponent(id)}?mode=raw`
|
2026-08-27 20:13:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function snippetUrl(id: string) {
|
|
|
|
|
if (typeof window === 'undefined') return `/${encodeURIComponent(id)}`
|
|
|
|
|
return new URL(`/${encodeURIComponent(id)}`, window.location.origin).toString()
|
|
|
|
|
}
|