Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
-------------------------------------------------- -- Midday Navigator. Браузер для сети OpenNet -- -- Автор: Zer0Galaxy -- -------------------------------------------------- gpu = require("component").gpu kbd = require("component").keyboard computer=require("computer") fs = require("filesystem") text = require("text") term = require("term") wlen = require("unicode").wlen event= require("event") on = require("opennet") local cursorX, cursorY = 1, 1 local ShiftX = 0 local ShiftY = 0 local Left,Top = 1, 3 local WinW, WinH = gpu.getResolution() WinH=WinH-Top+1 local Caption="Midday Navigator 1.0" local Site="" local txColour = 0xFFFFFF local bgColour = 0x000000 local tagColour = 0x0080FF local History = {} local object={} function winhead() gpu.setForeground(0xFFFFFF) gpu.setBackground(0x0000FF) gpu.fill(1,1, WinW,1, " ") gpu.set(2,1, Caption) gpu.setBackground(0x00FF00) gpu.set(WinW-8,1, " S ") gpu.setBackground(0x0080FF) gpu.set(WinW-5,1, " < ") gpu.setBackground(0xFF0000) gpu.set(WinW-2,1, " X ") gpu.setForeground(0x000000) gpu.setBackground(0xFFFFFF) gpu.fill(1,2, WinW,1, " ") gpu.set(2,2, Site) gpu.setForeground(txColour) gpu.setBackground(bgColour) end function winwrite(value) value = text.detab(tostring(value)) if wlen(value) == 0 then return end local line, nl repeat if cursorY > WinH then return end line, value, nl = text.wrap(value, WinW - (cursorX - 2), WinW) if cursorY>=1 then gpu.set(cursorX+Left-1-ShiftX, cursorY+Top-1, line) end cursorX = cursorX + wlen(line) if nl or (cursorX > WinW) then cursorX = 1 cursorY = cursorY + 1 end until not value end function winclear() object={} gpu.fill(Left, Top, WinW, WinH, " ") cursorX, cursorY = 1, 1 end tags={} tags['html']=function(arg) if arg.caption then Caption=arg.caption winhead() end local param=tonumber(arg.color) if param then txColour = param gpu.setForeground(param) end param=tonumber(arg.bgcolor) if param then bgColour = param gpu.setBackground(param) winclear() end end tags['font']=function(arg) local param=tonumber(arg.color) if param then gpu.setForeground(param) end param=tonumber(arg.bgcolor) if param then gpu.setBackground(param) end end tags['/font']=function() gpu.setForeground( txColour ) gpu.setBackground( bgColour ) end tags['cr']=function() -- if cursorX>1 then cursorY=cursorY+1 cursorX=1 -- end end tags['---']=function() if cursorX>1 then cursorY=cursorY+1 cursorX=1 end winwrite(string.rep('─',WinW)) end tags['===']=function() if cursorX>1 then cursorY=cursorY+1 cursorX=1 end winwrite(string.rep('═',WinW)) end local function line_check(obj,x,y) if y>=obj.y1 and y<=obj.y2 then if (x>=obj.x1 or y>obj.y1) and (x<=obj.x2 or y<obj.y2) then return true end end end local function bar_check(obj,x,y) return y>=obj.y1 and y<=obj.y2 and x>=obj.x1 and x<=obj.x2 end local function ref_work(obj) load(obj.ref) end tags['a']=function(arg) if arg.ref then table.insert(object, {check=line_check, x1=cursorX+Left-1-ShiftX, y1=cursorY+Top-1, work=ref_work, ref = arg.ref, col=gpu.getForeground()}) end local color=tonumber(arg.color) or tagColour gpu.setForeground(color) end tags['/a']=function() local ref=object[#object] if ref and not ref.x2 then gpu.setForeground(ref.col or txColour) ref.x2, ref.y2 = cursorX+Left-2-ShiftX, cursorY+Top-1 end end function tagWork(tag) local name=tag:match('%S+') if tags[name] then local params={} for k,v in tag:gmatch('(%w+)=([^%s"]+)') do params[k]=v end for k,v in tag:gmatch('(%w+)="([^"]+)"') do params[k]=v end tags[name](params) else winwrite( '<'..tag..'>' ) end end function winline(line) if line then cursorY=line.Y-ShiftY cursorX=line.X local sLine=line.text while string.len(sLine) > 0 do local p1,p2 p1=sLine:find("<") if p1 then p2=sLine:find(">",p1) end if p2 then winwrite(sLine:sub(1,p1-1)) tagWork(sLine:sub(p1+1,p2-1)) sLine=sLine:sub(p2+1) else winwrite(sLine) sLine="" end end if cursorY <= WinH then return true end end end function htmltext() winclear() local line=1 for i=#lines,1,-1 do if lines[i].Y<=ShiftY then line=i break end end while winline(lines[line]) do line=line+1 if lines[line] then lines[line].Y=ShiftY+cursorY lines[line].X=cursorX end end end function codetext() winclear() for i=1,WinH do if lines[i+ShiftY] then gpu.set(1-ShiftX,i+Top-1,lines[i+ShiftY].text) else break end end end wintext=htmltext function winshift(shX,shY) ShiftX=ShiftX+shX ShiftY=ShiftY+shY if ShiftX<0 then ShiftX=0 end if ShiftY<0 then ShiftY=0 end wintext() end function load(sPath) if sPath=='' or sPath==nil or sPath=="\n" then winhead() return end if sPath:sub(-1)=="\n" then sPath=sPath:sub(1,-2) end lines={} ShiftX=0 ShiftY=0 Caption="Midday Navigator 1.0" txColour = 0xFFFFFF bgColour = 0x000000 if sPath:sub(1,1)=="." then while sPath:sub(1,1)=="." do Site=Site:match("(.+)/.*") or Site sPath=sPath:sub(2) end Site=Site..sPath else Site=sPath end local host,doc=Site:match('(.-)/(.*)') if not host then host=Site doc=nil end if host=="" then local file=io.open(Site,"r") if file then for line in file:lines() do lines[#lines+1]={X=1,Y=math.huge,text=line} end file:close() else lines[1]={X=5,Y=1,text="<html>Файл <font color=0xFF0000>"..Site.."</font> не найден"} end else local MyIP,err=on.getIP() if MyIP then on.send(host,"get",doc) local adr,com,text repeat adr,com,text=on.receive(3) until com=="get" or not com if com=="get" then text=tostring(text) local line=1 while #text>0 do local p=text:find("\n") if p then lines[line],text={X=1,Y=math.huge,text=text:sub(1,p-1)}, text:sub(p+1) else lines[line],text={X=1,Y=math.huge,text=text}, "" end line=line+1 end else if adr then lines[1]={X=1,Y=math.huge,text="Ответ от узла "..tostring(adr)} lines[2]={X=1,Y=math.huge,text=tostring(text)} else lines[1]={X=1,Y=math.huge,text="Таймаут ожидания"} end end else lines[1]={X=5,Y=1,text="<html>Ошибка подключения к сети OpenNet: <font color=0xFF0000>"..err.."</font>"} end end wintext=codetext if lines[1] then lines[1].Y=1 if string.find(lines[1].text,"<%s*html.*>") then wintext=htmltext end end if History[#History]~=Site then table.insert( History, Site ) end winhead() wintext() end local work=true function read() gpu.setForeground( 0x000000 ) gpu.setBackground( 0xFFFFFF ) term.setCursor( 1, 2 ) term.clearLine() term.setCursor( 2, 2 ) load(term.read(History,false)) end function save() if kbd then gpu.setForeground( 0x000000 ) gpu.setBackground( 0xFFFFFF ) term.setCursor( 1, 2 ) term.clearLine() term.setCursor( 2, 2 ) term.write("Safe as: ") computer.pushSignal("key_down",kbd.address,0,200) local Name=term.read({"/download/"..Site:match("[^/]*$")},false):sub(1,-2) if Name~="" then if not fs.exists("download") then fs.makeDirectory("download") end local file=io.open(Name,"w") if file then for i=1,#lines-1 do file:write(lines[i].text.."\n") end file:write(lines[#lines].text) file:close() else term.clearLine() term.setCursor( 2, 2 ) term.write("File "..Name.." can't be saved") computer.beep() os.sleep(2) end end winhead() end end function back() if #History>1 then History[#History]=nil load(History[#History]) end end function quit() gpu.setForeground( 0xFFFFFF ) gpu.setBackground( 0x000000 ) term.clear() work=false end do local param=... if param then load(param) else winhead() read() end end local Sh=false while work do local ev, _, X, Y, S=event.pull() if ev=="scroll" and Y>=Top then if Sh then winshift(-5*S,0) else winshift(0,-3*S) end end if ev=="key_down" then if Y==208 then winshift(0,3) end if Y==200 then winshift(0,-3) end if Y==203 then winshift(-5,0) end if Y==205 then winshift(5,0) end if Y==29 then Sh=true end if Y==15 then read() end if Sh and Y==31 then save() end if Y==14 then back() end if Sh and Y==17 then quit() end end if ev=="key_up" and Y==29 then Sh=false end if ev=="touch" and S==0 then if Y==1 then if X>=WinW-8 and X<=WinW-6 then save() end if X>=WinW-5 and X<=WinW-3 then back() end if X>=WinW-2 then quit() end elseif Y==2 then read() else for i=1,#object do if object[i]:check(X,Y) then object[i]:work() break end end end end end
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
✅ MAKE $500 IN 15 MIN
JavaScript | 2 sec ago | 0.32 KB
⭐⭐⭐MAKE $500 IN 15 MIN⭐⭐⭐
Java | 2 sec ago | 0.06 KB
ChangeNOW Exploit
JavaScript | 13 sec ago | 0.32 KB
⭐⭐⭐Profit Method⭐⭐⭐
Java | 13 sec ago | 0.06 KB
⭐⭐⭐ChangeNOW Exploit⭐⭐⭐
Java | 17 sec ago | 0.09 KB
⭐⭐⭐Make $1500 in 20 minutes⭐⭐⭐
Java | 25 sec ago | 0.09 KB
⭐⭐⭐MAKE $900 INSTANTLY⭐⭐⭐
Java | 28 sec ago | 0.06 KB
⭐ Instant Profit Method ⭐
JavaScript | 34 sec ago | 0.32 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!