支持配置允许上传的文档类型

dev
truthhun 1 year ago
parent 2662f98059
commit 6e8b31e45a

@ -542,15 +542,16 @@ func (m *ConfigFooter) GetFeedback() string {
// 安全配置
type ConfigSecurity struct {
IsClose bool `protobuf:"varint,1,opt,name=is_close,json=isClose,proto3" json:"is_close,omitempty"`
CloseStatement string `protobuf:"bytes,2,opt,name=close_statement,json=closeStatement,proto3" json:"close_statement,omitempty"`
EnableRegister bool `protobuf:"varint,3,opt,name=enable_register,json=enableRegister,proto3" json:"enable_register,omitempty"`
EnableCaptchaLogin bool `protobuf:"varint,4,opt,name=enable_captcha_login,json=enableCaptchaLogin,proto3" json:"enable_captcha_login,omitempty"`
EnableCaptchaRegister bool `protobuf:"varint,5,opt,name=enable_captcha_register,json=enableCaptchaRegister,proto3" json:"enable_captcha_register,omitempty"`
EnableCaptchaComment bool `protobuf:"varint,6,opt,name=enable_captcha_comment,json=enableCaptchaComment,proto3" json:"enable_captcha_comment,omitempty"`
EnableCaptchaFindPassword bool `protobuf:"varint,7,opt,name=enable_captcha_find_password,json=enableCaptchaFindPassword,proto3" json:"enable_captcha_find_password,omitempty"`
EnableCaptchaUpload bool `protobuf:"varint,8,opt,name=enable_captcha_upload,json=enableCaptchaUpload,proto3" json:"enable_captcha_upload,omitempty"`
MaxDocumentSize int32 `protobuf:"varint,9,opt,name=max_document_size,json=maxDocumentSize,proto3" json:"max_document_size,omitempty"`
IsClose bool `protobuf:"varint,1,opt,name=is_close,json=isClose,proto3" json:"is_close,omitempty"`
CloseStatement string `protobuf:"bytes,2,opt,name=close_statement,json=closeStatement,proto3" json:"close_statement,omitempty"`
EnableRegister bool `protobuf:"varint,3,opt,name=enable_register,json=enableRegister,proto3" json:"enable_register,omitempty"`
EnableCaptchaLogin bool `protobuf:"varint,4,opt,name=enable_captcha_login,json=enableCaptchaLogin,proto3" json:"enable_captcha_login,omitempty"`
EnableCaptchaRegister bool `protobuf:"varint,5,opt,name=enable_captcha_register,json=enableCaptchaRegister,proto3" json:"enable_captcha_register,omitempty"`
EnableCaptchaComment bool `protobuf:"varint,6,opt,name=enable_captcha_comment,json=enableCaptchaComment,proto3" json:"enable_captcha_comment,omitempty"`
EnableCaptchaFindPassword bool `protobuf:"varint,7,opt,name=enable_captcha_find_password,json=enableCaptchaFindPassword,proto3" json:"enable_captcha_find_password,omitempty"`
EnableCaptchaUpload bool `protobuf:"varint,8,opt,name=enable_captcha_upload,json=enableCaptchaUpload,proto3" json:"enable_captcha_upload,omitempty"`
MaxDocumentSize int32 `protobuf:"varint,9,opt,name=max_document_size,json=maxDocumentSize,proto3" json:"max_document_size,omitempty"`
DocumentAllowedExt []string `protobuf:"bytes,10,rep,name=document_allowed_ext,json=documentAllowedExt,proto3" json:"document_allowed_ext,omitempty"`
}
func (m *ConfigSecurity) Reset() { *m = ConfigSecurity{} }
@ -649,6 +650,13 @@ func (m *ConfigSecurity) GetMaxDocumentSize() int32 {
return 0
}
func (m *ConfigSecurity) GetDocumentAllowedExt() []string {
if m != nil {
return m.DocumentAllowedExt
}
return nil
}
type Settings struct {
System *ConfigSystem `protobuf:"bytes,1,opt,name=system,proto3" json:"system,omitempty"`
Footer *ConfigFooter `protobuf:"bytes,2,opt,name=footer,proto3" json:"footer,omitempty"`
@ -994,98 +1002,100 @@ func init() {
func init() { proto.RegisterFile("api/v1/config.proto", fileDescriptor_321614cd6c9c1b8a) }
var fileDescriptor_321614cd6c9c1b8a = []byte{
// 1453 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0x4b, 0x6f, 0x1b, 0xb7,
0x16, 0xce, 0x48, 0xd6, 0x8b, 0x92, 0x65, 0x9b, 0x7e, 0x44, 0x56, 0x72, 0x1d, 0x67, 0x2e, 0xee,
0xbd, 0x4e, 0x70, 0x61, 0xc5, 0xee, 0x63, 0xd1, 0x2e, 0x02, 0xc7, 0x71, 0xd2, 0x00, 0x59, 0xa4,
0xe3, 0x04,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5,
0x87, 0x54, 0xc3, 0xae, 0xb8, 0x2c, 0x51, 0x6b, 0x66, 0x7f, 0x28, 0x7f, 0x03, 0xf2, 0xb4, 0x71,
0x2b, 0xcf, 0x63, 0xf6, 0x09, 0xfe, 0x12, 0x2d, 0xdb, 0xda, 0x9d, 0x32, 0x4d, 0xc7, 0x24, 0xbd,
0x34, 0xd9, 0x65, 0x35, 0xbc, 0x0a, 0x69, 0xd7, 0xba, 0x2b, 0xc5, 0xf4, 0x6c, 0xa2, 0x7b, 0x1f,
0xfd, 0xfc, 0x76, 0xc7, 0x7b, 0xf3, 0x76, 0xc7, 0xfb, 0xfd, 0xed, 0x8e, 0xf7, 0xfa, 0xdd, 0xce,
0x95, 0x37, 0xef, 0x76, 0xae, 0xfc, 0xfa, 0x6e, 0xe7, 0x0a, 0x72, 0x7f, 0x0c, 0x4f, 0xbc, 0xaf,
0xd7, 0xc6, 0x42, 0xd2, 0x58, 0x44, 0x2e, 0xf6, 0xd3, 0xc9, 0x41, 0xbf, 0x0a, 0xf9, 0x3f, 0xf8,
0x27, 0x00, 0x00, 0xff, 0xff, 0x21, 0x0a, 0x6c, 0xf4, 0x6c, 0x0c, 0x00, 0x00,
// 1473 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0xcb, 0x6f, 0x1b, 0xb7,
0x13, 0xce, 0x4a, 0xd6, 0x8b, 0x92, 0x65, 0x9b, 0x7e, 0x44, 0x56, 0xf2, 0x73, 0x9c, 0xfd, 0xa1,
0xad, 0x13, 0x14, 0x56, 0xec, 0x3e, 0x0e, 0xed, 0x21, 0x70, 0x1c, 0x27, 0x0d, 0x90, 0x43, 0xba,
0x4e, 0xd0, 0xc7, 0x65, 0x41, 0xed, 0xd2, 0x12, 0xe1, 0x15, 0xb9, 0x21, 0xb9, 0x8a, 0x95, 0x63,
0x4f, 0x3d, 0x06, 0x28, 0xd0, 0x43, 0xff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aa, 0x61, 0x57, 0x5c, 0x96, 0xa8, 0x35, 0xb5, 0x3f, 0x94, 0xbf,
0x06, 0x79, 0xda, 0xb8, 0x95, 0xe7, 0x31, 0xfb, 0x04, 0x7f, 0x8d, 0x16, 0x6d, 0xed, 0x8e, 0x99,
0xa6, 0x23, 0x92, 0x5e, 0x9a, 0xec, 0xb2, 0x1a, 0x5e, 0x85, 0xb4, 0x2b, 0xdd, 0xa5, 0x62, 0x7a,
0x36, 0xd1, 0xbd, 0x4f, 0x7e, 0x79, 0xb3, 0xe5, 0xbd, 0x7e, 0xb3, 0xe5, 0xfd, 0xf1, 0x66, 0xcb,
0x7b, 0xf5, 0x76, 0xeb, 0xca, 0xeb, 0xb7, 0x5b, 0x57, 0x7e, 0x7b, 0xbb, 0x75, 0x05, 0xb9, 0x7f,
0x8c, 0x27, 0xde, 0xb7, 0x2b, 0x23, 0x21, 0x69, 0x2c, 0x22, 0x17, 0xfb, 0xf9, 0x78, 0xaf, 0x5f,
0x85, 0xfc, 0x1f, 0xfd, 0x17, 0x00, 0x00, 0xff, 0xff, 0x79, 0xec, 0x16, 0x60, 0x9e, 0x0c, 0x00,
0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -1777,6 +1787,15 @@ func (m *ConfigSecurity) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.DocumentAllowedExt) > 0 {
for iNdEx := len(m.DocumentAllowedExt) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.DocumentAllowedExt[iNdEx])
copy(dAtA[i:], m.DocumentAllowedExt[iNdEx])
i = encodeVarintConfig(dAtA, i, uint64(len(m.DocumentAllowedExt[iNdEx])))
i--
dAtA[i] = 0x52
}
}
if m.MaxDocumentSize != 0 {
i = encodeVarintConfig(dAtA, i, uint64(m.MaxDocumentSize))
i--
@ -2374,6 +2393,12 @@ func (m *ConfigSecurity) Size() (n int) {
if m.MaxDocumentSize != 0 {
n += 1 + sovConfig(uint64(m.MaxDocumentSize))
}
if len(m.DocumentAllowedExt) > 0 {
for _, s := range m.DocumentAllowedExt {
l = len(s)
n += 1 + l + sovConfig(uint64(l))
}
}
return n
}
@ -4120,6 +4145,38 @@ func (m *ConfigSecurity) Unmarshal(dAtA []byte) error {
break
}
}
case 10:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DocumentAllowedExt", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowConfig
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthConfig
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthConfig
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DocumentAllowedExt = append(m.DocumentAllowedExt, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipConfig(dAtA[iNdEx:])

@ -76,6 +76,7 @@ message ConfigSecurity {
bool enable_captcha_find_password = 7;
bool enable_captcha_upload = 8;
int32 max_document_size = 9;
repeated string document_allowed_ext = 10;
}
message Settings {

@ -198,9 +198,16 @@ func (s *AttachmentAPIService) UploadDocument(ctx *gin.Context) {
return
}
unsuportedExt := "不支持的文档类型"
ext := strings.ToLower(filepath.Ext(fileheader.Filename))
if !filetil.IsDocument(ext) {
ctx.JSON(http.StatusBadRequest, ginResponse{Code: http.StatusBadRequest, Message: "不支持的文件类型", Error: "不支持的文件类型"})
ctx.JSON(http.StatusBadRequest, ginResponse{Code: http.StatusBadRequest, Message: unsuportedExt, Error: unsuportedExt})
return
}
allowedExt := s.dbModel.GetConfigOfSecurity(model.ConfigSecurityDocumentAllowedExt).DocumentAllowedExt
if len(allowedExt) > 0 && !util.InSlice(allowedExt, ext) {
ctx.JSON(http.StatusBadRequest, ginResponse{Code: http.StatusBadRequest, Message: unsuportedExt, Error: unsuportedExt})
return
}

@ -4,6 +4,7 @@ import (
"crypto/tls"
"errors"
"moredoc/util/captcha"
"moredoc/util/filetil"
"strconv"
"strings"
"time"
@ -224,19 +225,21 @@ const (
ConfigSecurityEnableCaptchaComment = "enable_captcha_comment" // 是否开启注册验证码
ConfigSecurityEnableCaptchaFindPassword = "enable_captcha_find_password" // 是否开启注册验证码
ConfigSecurityDocumentRelatedDuration = "document_related_duration" // 相关文档有效期默认为7天最小值为1
ConfigSecurityDocumentAllowedExt = "document_allowed_ext" // 允许上传的文档类型
)
type ConfigSecurity struct {
MaxDocumentSize int32 `json:"max_document_size"` // 允许上传的最大文档大小
CommentInterval int32 `json:"comment_interval"` // 评论时间间隔, 单位秒
DocumentRelatedDuration int32 `json:"document_related_duration"` // 相关文档有效期默认为7天最小值为1
IsClose bool `json:"is_close"` // 是否闭站
CloseStatement string `json:"close_statement"` // 闭站说明
EnableRegister bool `json:"enable_register"` // 是否启用注册
EnableCaptchaLogin bool `json:"enable_captcha_login"` // 是否启用登录验证码
EnableCaptchaRegister bool `json:"enable_captcha_register"` // 是否启用注册验证码
EnableCaptchaComment bool `json:"enable_captcha_comment"` // 是否启用评论验证码
EnableCaptchaFindPassword bool `json:"enable_captcha_find_password"` // 找回密码是否需要验证码
MaxDocumentSize int32 `json:"max_document_size"` // 允许上传的最大文档大小
CommentInterval int32 `json:"comment_interval"` // 评论时间间隔, 单位秒
DocumentRelatedDuration int32 `json:"document_related_duration"` // 相关文档有效期默认为7天最小值为1
IsClose bool `json:"is_close"` // 是否闭站
CloseStatement string `json:"close_statement"` // 闭站说明
EnableRegister bool `json:"enable_register"` // 是否启用注册
EnableCaptchaLogin bool `json:"enable_captcha_login"` // 是否启用登录验证码
EnableCaptchaRegister bool `json:"enable_captcha_register"` // 是否启用注册验证码
EnableCaptchaComment bool `json:"enable_captcha_comment"` // 是否启用评论验证码
EnableCaptchaFindPassword bool `json:"enable_captcha_find_password"` // 找回密码是否需要验证码
DocumentAllowedExt []string `json:"document_allowed_ext"` // 允许上传的文档类型
}
const (
@ -495,6 +498,12 @@ func (m *DBModel) GetConfigOfSecurity(name ...string) (config ConfigSecurity) {
data[cfg.Name] = value
case "max_document_size", "comment_interval", ConfigSecurityDocumentRelatedDuration:
data[cfg.Name], _ = strconv.Atoi(cfg.Value)
case ConfigSecurityDocumentAllowedExt:
arr := strings.Split(cfg.Value, ",")
if len(arr) == 1 && arr[0] == "" {
arr = []string{}
}
data[cfg.Name] = arr
default:
data[cfg.Name] = cfg.Value
}
@ -636,11 +645,12 @@ func (m *DBModel) initConfig() (err error) {
{Category: ConfigCategoryCaptcha, Name: ConfigCaptchaType, Label: "验证码类型", Value: "digit", Placeholder: "请选择验证码类型,默认为数字", InputType: "select", Sort: 16, Options: captcha.CaptchaTypeOptions},
// 安全配置项
{Category: ConfigCategorySecurity, Name: ConfigSecurityMaxDocumentSize, Label: "最大文档大小(MB)", Value: "50", Placeholder: "允许用户上传的最大文档大小默认为50即50MB", InputType: "number", Sort: 15, Options: ""},
{Category: ConfigCategorySecurity, Name: ConfigSecurityCommentInterval, Label: "评论时间间隔", Value: "10", Placeholder: "用户评论时间间隔单位为秒。0表示不限制。", InputType: "number", Sort: 15, Options: ""},
{Category: ConfigCategorySecurity, Name: ConfigSecurityMaxDocumentSize, Label: "最大文档大小(MB)", Value: "50", Placeholder: "允许用户上传的最大文档大小默认为50即50MB", InputType: "number", Sort: 1, Options: ""},
{Category: ConfigCategorySecurity, Name: ConfigSecurityCommentInterval, Label: "评论时间间隔", Value: "10", Placeholder: "用户评论时间间隔单位为秒。0表示不限制。", InputType: "number", Sort: 2, Options: ""},
{Category: ConfigCategorySecurity, Name: ConfigSecurityDocumentRelatedDuration, Label: "文档的【相关文档】有效期", Value: "7", Placeholder: "文档的相关联文档的有效期默认为7即7天0或小于0表示不开启相关文档功能", InputType: "number", Sort: 15, Options: ""},
{Category: ConfigCategorySecurity, Name: ConfigSecurityIsClose, Label: "是否关闭网站", Value: "false", Placeholder: "请选择是否关闭网站", InputType: "switch", Sort: 16, Options: ""},
{Category: ConfigCategorySecurity, Name: ConfigSecurityCloseStatement, Label: "闭站说明", Value: "false", Placeholder: "关闭网站后,页面提示的内容", InputType: "textarea", Sort: 17, Options: ""},
{Category: ConfigCategorySecurity, Name: ConfigSecurityDocumentAllowedExt, Label: "允许上传的文档类型", Value: "", Placeholder: "留空表示允许程序所支持的全部文档类型", InputType: "select-multi", Sort: 3, Options: strings.Join(filetil.GetDocumentExts(), "\n")},
{Category: ConfigCategorySecurity, Name: ConfigSecurityIsClose, Label: "【WIP】是否关闭网站", Value: "false", Placeholder: "请选择是否关闭网站", InputType: "switch", Sort: 160, Options: ""},
{Category: ConfigCategorySecurity, Name: ConfigSecurityCloseStatement, Label: "【WIP】闭站说明", Value: "false", Placeholder: "关闭网站后,页面提示的内容", InputType: "textarea", Sort: 170, Options: ""},
{Category: ConfigCategorySecurity, Name: ConfigSecurityEnableRegister, Label: "是否允许注册", Value: "true", Placeholder: "请选择是否允许用户注册", InputType: "switch", Sort: 18, Options: ""},
{Category: ConfigCategorySecurity, Name: ConfigSecurityEnableCaptchaLogin, Label: "是否开启登录验证码", Value: "true", Placeholder: "请选择是否开启登录验证码", InputType: "switch", Sort: 19, Options: ""},
{Category: ConfigCategorySecurity, Name: ConfigSecurityEnableCaptchaRegister, Label: "是否开启注册验证码", Value: "true", Placeholder: "请选择是否开启注册验证码", InputType: "switch", Sort: 20, Options: ""},

@ -1,18 +1,16 @@
package captcha
import (
"strings"
"github.com/mojocn/base64Captcha"
)
var (
store = base64Captcha.DefaultMemStore
width = 240
height = 60
sourceChinese = strings.Join(strings.Split("欢迎使用由深圳市摩枫网络科技有限公司基于阿帕奇开源协议的魔豆文库系统", ""), ",")
store = base64Captcha.DefaultMemStore
width = 240
height = 60
// sourceChinese = strings.Join(strings.Split("欢迎使用由深圳市摩枫网络科技有限公司基于阿帕奇开源协议的魔豆文库系统", ""), ",")
sourceString = "1234567890qwertyuioplkjhgfdsazxcvbnm"
CaptchaTypeOptions = "string:字符串\nmath:算术\nchinese:中文\ndigit:数字\naudio:语音"
CaptchaTypeOptions = "string:字符串\nmath:算术\ndigit:数字\naudio:语音"
)
const (

@ -101,3 +101,10 @@ func GetImageSize(file string) (width, height int, err error) {
height = img.Bounds().Max.Y
return
}
func GetDocumentExts() (exts []string) {
for _, ext := range documentExtMap {
exts = append(exts, ext...)
}
return
}

@ -210,3 +210,12 @@ func GetOSRelease() (osVersion string, err error) {
}
return
}
func InSlice[T Any](slice []T, value T) bool {
for _, v := range slice {
if v == value {
return true
}
}
return false
}

@ -37,6 +37,19 @@
:value="option.split(':')[0]"
></el-option>
</el-select>
<el-select
v-else-if="item.input_type === 'select-multi'"
v-model="configs[index]['value']"
multiple
clearable
>
<el-option
v-for="option in item.options.split('\n')"
:key="'option-' + option"
:label="option.split(':')[1]"
:value="option.split(':')[0]"
></el-option>
</el-select>
<el-switch
v-else-if="item.input_type === 'switch'"
v-model="configs[index]['value']"
@ -96,13 +109,29 @@ export default {
watch: {
initConfigs: {
handler(val) {
this.configs = { ...val }
let configs = { ...val }
Object.values(configs).forEach((item) => {
if (item.input_type === 'select-multi') {
try {
item.value = item.value.split(',')
} catch (error) {}
}
})
this.configs = configs
},
immediate: true,
},
},
created() {
this.configs = { ...this.initConfigs }
let configs = { ...this.initConfigs }
Object.values(configs).forEach((item) => {
if (item.input_type === 'select-multi') {
try {
item.value = item.value.split(',')
} catch (error) {}
}
})
this.configs = configs
},
methods: {
async onSubmit() {

@ -186,28 +186,29 @@
</li> -->
<li>
4. 目前支持的文档类型
<div>
<div v-if="wordExt.length > 0">
<img src="/static/images/word_24.png" alt="Word文档" />
docdocxrtfwpsodt
{{ wordExt.join('') }}
</div>
<div>
<div v-if="pptExt.length > 0">
<img src="/static/images/ppt_24.png" alt="PPT文档" />
pptpptxppsppsxdpsodppot
{{ pptExt.join('') }}
</div>
<div>
<div v-if="excelExt.length > 0">
<img src="/static/images/excel_24.png" alt="Excel文档" />
xlsxlsxetodscsvtsv
{{ excelExt.join('') }}
</div>
<div>
<div v-if="otherExt.length > 0">
<img src="/static/images/other_24.png" alt="其他文档" />
epubumdchmmobi
{{ otherExt.join('') }}
</div>
<div>
<img src="/static/images/text_24.png" alt="TXT文档" /> txt
<div v-if="allowExt.includes('.txt')">
<img src="/static/images/text_24.png" alt="TXT文档" />
.txt
</div>
<div>
<div v-if="allowExt.includes('.pdf')">
<img src="/static/images/pdf_24.png" alt="PDF文档" />
pdf
.pdf
</div>
</li>
<li>
@ -266,6 +267,7 @@ export default {
'.rtf',
'.wps',
'.odt',
'.dot',
'.ppt',
'.pptx',
'.pps',
@ -286,6 +288,14 @@ export default {
'.txt',
'.pdf',
],
wordExtEnum: ['.doc', '.docx', '.rtf', '.wps', '.odt', '.dot'],
pptExtEnum: ['.ppt', '.pptx', '.pps', '.ppsx', '.dps', '.odp', '.pot'],
excelExtEnum: ['.xls', '.xlsx', '.csv', '.tsv', '.et', '.ods'],
otherExtEnum: ['.epub', '.umd', '.chm', '.mobi'],
wordExt: [],
pptExt: [],
excelExt: [],
otherExt: [],
}
},
head() {
@ -315,8 +325,30 @@ export default {
if (res.status === 200) {
this.canIUploadDocument = true
}
this.maxDocumentSize =
(this.settings.security.max_document_size || 50) * 1024 * 1024
try {
this.maxDocumentSize =
(this.settings.security.max_document_size || 50) * 1024 * 1024
} catch (error) {
console.log(error)
}
try {
this.allowExt =
this.settings.security.document_allowed_ext || this.allowExt
} catch (error) {
console.log(error)
}
this.allowExt.map((ext) => {
if (this.wordExtEnum.includes(ext)) {
this.wordExt.push(ext)
} else if (this.pptExtEnum.includes(ext)) {
this.pptExt.push(ext)
} else if (this.excelExtEnum.includes(ext)) {
this.excelExt.push(ext)
} else if (this.otherExtEnum.includes(ext)) {
this.otherExt.push(ext)
}
})
},
methods: {
formatBytes,

Loading…
Cancel
Save