Huge refactor, submission system addition & security improvements. +Implementation of moderation cmds.
This commit is contained in:
16
frontend/src/lib/lang.js
Normal file
16
frontend/src/lib/lang.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const EXT_TO_LANG = {
|
||||
py: 'python', rs: 'rust', js: 'javascript', ts: 'typescript',
|
||||
jsx: 'javascript', tsx: 'typescript', c: 'c', cpp: 'cpp', cc: 'cpp',
|
||||
h: 'c', hpp: 'cpp', go: 'go', java: 'java', kt: 'kotlin',
|
||||
swift: 'swift', rb: 'ruby', php: 'php', cs: 'csharp', scala: 'scala',
|
||||
r: 'r', m: 'objectivec', mm: 'objectivec', pl: 'perl', lua: 'lua',
|
||||
json: 'json', xml: 'xml', yaml: 'yaml', yml: 'yaml', toml: 'toml',
|
||||
ini: 'ini', cfg: 'ini', sh: 'bash', bash: 'bash', ps1: 'powershell',
|
||||
bat: 'batch', cmd: 'batch', sql: 'sql', dockerfile: 'dockerfile',
|
||||
makefile: 'makefile', cmake: 'cmake',
|
||||
};
|
||||
|
||||
export function detectLanguage(fileName) {
|
||||
const ext = fileName.split('.').pop()?.toLowerCase();
|
||||
return ext ? (EXT_TO_LANG[ext] || null) : null;
|
||||
}
|
||||
Reference in New Issue
Block a user