📄 viewer.pm
字号:
#!/usr/bin/perlpackage viewer;sub new { my %self; shift; %self = @_; $_ = bless \%self; return $_;}sub new_file { my $self = shift;}sub EDITMAIN { my $self = shift; $self->{conf}{CURRENTEDIT} =~ /([^\.]+)$/; my $ext = $1; if($ext && -f $self->{conf}{mimefile}) { open(MIME, $self->{conf}{mimefile}) or return; while(<MIME>) { next if /^[\#\s]/; next unless /\b\Q$ext\E\b/i; $self->{contenttype} = ((split /\s+/, $_, 2)[0]); $self->{contenttype} =~ s|^text/.*|text/plain|; last; } } unless($self->{contenttype}) { if($self->{conf}{EDITDATA} =~ /[\x80-\xff]/) { $self->{contenttype} = "Application/Octet-Stream"; } else { $self->{contenttype} = 'text/plain'; } } $self->{conf}{specialheader} = "Connection: close\n"; $self->{conf}{specialheader} .= qq`Content-Type: $self->{contenttype};name="$self->{conf}{CURRENTEDIT}"\n`; $self->{conf}{specialheader} .= qq`Content-Disposition: attachment;filename="$self->{conf}{CURRENTEDIT}"\n\n`; return \$self->{conf}{EDITDATA};}1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -