From fbdc992b3029d53354c05454eb1ad25c84e4b979 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 12 Jul 2024 14:23:50 +0300 Subject: [PATCH] net.http, veb, vweb, x.vweb: add mime type `text/x-vlang`, for `.v` and `.vsh` file extensions (#21851) --- vlib/net/http/mime/build.vsh | 3 +++ vlib/net/http/mime/db.v | 2 ++ vlib/veb/veb.v | 2 ++ vlib/vweb/vweb.v | 2 ++ vlib/x/vweb/vweb.v | 2 ++ 5 files changed, 11 insertions(+) diff --git a/vlib/net/http/mime/build.vsh b/vlib/net/http/mime/build.vsh index 7b1b7f9a9..5b667c38f 100755 --- a/vlib/net/http/mime/build.vsh +++ b/vlib/net/http/mime/build.vsh @@ -21,6 +21,8 @@ fn main() { ext_to_mt_str[ext] = mt_str } } + ext_to_mt_str['v'] = 'text/x-vlang' + ext_to_mt_str['vsh'] = 'text/x-vlang' write_file('db.v', ' module mime @@ -32,4 +34,5 @@ fn main() { const ext_to_mt_str = ${ext_to_mt_str} ')! execute('${@VEXE} fmt -w db.v') + println('db.v was regenerated. New file size: ${file_size('db.v')} bytes .') } diff --git a/vlib/net/http/mime/db.v b/vlib/net/http/mime/db.v index b237d08b4..e89f78ee2 100644 --- a/vlib/net/http/mime/db.v +++ b/vlib/net/http/mime/db.v @@ -15332,4 +15332,6 @@ const ext_to_mt_str = { 'movie': 'video/x-sgi-movie' 'smv': 'video/x-smv' 'ice': 'x-conference/x-cooltalk' + 'v': 'text/x-vlang' + 'vsh': 'text/x-vlang' } diff --git a/vlib/veb/veb.v b/vlib/veb/veb.v index 95f720610..2968c31d1 100644 --- a/vlib/veb/veb.v +++ b/vlib/veb/veb.v @@ -162,6 +162,8 @@ pub const mime_types = { '.3g2': 'video/3gpp2' '.7z': 'application/x-7z-compressed' '.m3u8': 'application/vnd.apple.mpegurl' + '.vsh': 'text/x-vlang' + '.v': 'text/x-vlang' } pub const max_http_post_size = 1024 * 1024 diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index 175b67fb4..ea3754d25 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -143,6 +143,8 @@ pub const mime_types = { '.3g2': 'video/3gpp2' '.7z': 'application/x-7z-compressed' '.m3u8': 'application/vnd.apple.mpegurl' + '.vsh': 'text/x-vlang' + '.v': 'text/x-vlang' } pub const max_http_post_size = 1024 * 1024 pub const default_port = 8080 diff --git a/vlib/x/vweb/vweb.v b/vlib/x/vweb/vweb.v index ae0259f59..b4880493d 100644 --- a/vlib/x/vweb/vweb.v +++ b/vlib/x/vweb/vweb.v @@ -163,6 +163,8 @@ pub const mime_types = { '.3g2': 'video/3gpp2' '.7z': 'application/x-7z-compressed' '.m3u8': 'application/vnd.apple.mpegurl' + '.vsh': 'text/x-vlang' + '.v': 'text/x-vlang' } pub const max_http_post_size = 1024 * 1024 -- 2.39.5