Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --License:
- --The code of "EnderOS" in any form is intellectual
- --property of SuicidalSTDz. You may not reproduce,
- --redistribute, or modify it in any way!
- --IGNORE!
- --Replace this with your name and anyone else that is allowed on your computer
- playerDetection = false
- allowedPlayers = "SuicidalSTDz","Notch","direwolf20"
- reset()
- if not fs.exists("/.EnderOS/.startupInstalled") then
- local running = shell.getRunningProgram()
- print("EnderOS has detected a startup file that it clashes with!")
- print("EnderOS is about to delete this file and install itself in its place")
- print("Do you wish to continue? Yes or No?")
- local input = read()
- if input == "Yes" then
- shell.run("delete","startup")
- fs.move(running, "startup")
- reset()
- print("File removed and EnderOS implanted within the startup file")
- sleep(5)
- local newStartup = fs.open(".EnderOS/.startupInstalled", "w")
- newStartup:close()
- else
- os.reboot()
- end
- end
- function settingsChangeUser()
- reset()
- term.setTextColor(colors.orange)
- local passFile = io.open("/.EnderOS/.passInfo", "r")
- local passContents = passFile:read()
- passFile:close()
- print("Please enter your password: ")
- if read("*") ~= passContents then
- print("Invalid password")
- sleep(1.5)
- settingsChangeUser()
- else
- local user = ("/.EnderOS/.userInfo")
- io.open(user)
- local username = io.open(user, "w")
- print("Enter new username: ")
- writeUser = read()
- writeN = username:write(writeUser)
- username:close()
- print("Your new username is "..writeUser)
- sleep(2)
- start()
- end
- term.setTextColor(colors.white)
- end
- function settingsChangePass()
- reset()
- term.setTextColor(colors.orange)
- local passFile = io.open("/.EnderOS/.passInfo", "r")
- local passContents = passFile:read()
- passFile:close()
- print("Please enter your password: ")
- if read("*") ~= passContents then
- print("Invalid password")
- sleep(1.5)
- settingsChangePass()
- else
- local pass = ("/.EnderOS/.passInfo")
- io.open(pass)
- local password = io.open(pass, "w")
- print("Enter new password: ")
- local writePass = read("*")
- local writeN = password:write(writePass)
- password:close()
- print("Your new password is "..writePass)
- sleep(2)
- start()
- end
- term.setTextColor(colors.white)
- end
- function settingsChangeHint()
- reset()
- term.setTextColor(colors.orange)
- local passFile = io.open("/.EnderOS/.passInfo", "r")
- local passContents = passFile:read()
- passFile:close()
- print("Please enter your password: ")
- if read("*") ~= passContents then
- print("Invalid password")
- sleep(1.5)
- settingsChangeHint()
- else
- local hint = ("/.EnderOS/.userHint")
- io.open(hint)
- local uHint = io.open(hint, "w")
- print("Enter new hint: ")
- local writeHint = read("*")
- local writeN = uHint:write(writeHint)
- uHint:close()
- print("Your new hint is "..writeHint)
- sleep(2)
- start()
- end
- term.setTextColor(colors.white)
- end
- local version = "v1.8"
- userfile = shell.getRunningProgram()
- local dot = string.byte(shell.getRunningProgram())
- local v = ".(Period)"
- function reset()
- term.clear()
- term.setCursorPos(1,1)
- end
- function userInfo()
- reset()
- fs.makeDir("/.EnderOS/")
- user = ("/.EnderOS/.userInfo")
- io.open(user)
- username = io.open(user, "w")
- print("Please enter your desired Username")
- writeUser = read()
- writeIsFailUser = username:write(writeUser)
- username:close()
- pass = ("/.EnderOS/.passInfo")
- io.open(pass)
- password = io.open(pass, "w")
- print("Please enter your desired Password")
- writePass = read("*")
- writeIsFailPass = password:write(writePass)
- password:close()
- hint = ("/.EnderOS/.userHint")
- io.open(hint)
- uHint = io.open(hint, "w")
- print("Please enter your desired Password hint")
- writeHint = read()
- writeIsFailHint = uHint:write(writeHint)
- uHint:close()
- local installC = fs.open("/.EnderOS/.EnderOSisInstalled", "w")
- installC:close()
- end
- function frame()
- print("+-------------------------------------------------+")
- for i = 1,17 do
- print("| |")
- end
- term.write("+-------------------------------------------------+")
- end
- function no()
- term.clear()
- term.setTextColor(colors.red)
- term.setCursorPos(1,1)
- print("Sorry, I have not coded this in yet. Please be patient.")
- sleep(3)
- end
- function screen()
- reset()
- term.setTextColor(colors.lime)
- print("+-------------------------------------------------+")
- print("| |")
- print("| ")
- term.setCursorPos(19,3)
- term.setTextColor(colors.purple)
- write("EnderOS "..version)
- term.setTextColor(colors.lime)
- term.setCursorPos(31,3)
- print(" |")
- print("| |")
- print("| |")
- print("| |")
- print("| |")
- print("| ")
- term.setCursorPos(10,8)
- term.setTextColor(colors.orange)
- print("Username:")
- term.setCursorPos(19,8)
- print(" ")
- term.setCursorPos(50,8)
- term.setTextColor(colors.lime)
- print(" |")
- print("| |")
- print("| ")
- term.setTextColor(colors.orange)
- term.setCursorPos(10,10)
- print("Password:")
- term.setCursorPos(19,10)
- print(" ")
- term.setCursorPos(50,10)
- term.setTextColor(colors.lime)
- print(" |")
- print("| |")
- print("| |")
- print("| ")
- term.setCursorPos(8,13)
- term.setTextColor(colors.blue)
- print("forgot password ")
- term.setCursorPos(50,13)
- term.setTextColor(colors.lime)
- print(" |")
- print("| |")
- print("| |")
- print("| |")
- print("| |")
- print("| |")
- write("+-------------------------------------------------+")
- end
- function click()
- local userHint = io.open("/.EnderOS/.userHint", "r")
- hintContents = userHint:read()
- userHint:close()
- local event, button, xPos, yPos = os.pullEvent("mouse_click")
- if button == 1 then
- if (xPos >=8 and xPos <=22 and yPos == 13) then
- term.setCursorPos(10,15)
- term.setTextColor(colors.red)
- print("Hint: "..hintContents)
- term.setTextColor(colors.white)
- click()
- elseif (xPos >=10 and xPos <=18 and yPos == 8) then
- term.setCursorPos(20,8)
- else
- screen()
- click()
- end
- else
- click()
- end
- end
- function login()
- click()
- local userFile = io.open("/.EnderOS/.userInfo", "r")
- userContents = userFile:read()
- userFile:close()
- local passFile = io.open("/.EnderOS/.passInfo", "r")
- passContents = passFile:read()
- passFile:close()
- term.setTextColor(colors.white)
- if read() == userContents then
- term.setCursorPos(8,8)
- term.setTextColor(colors.lime)
- term.write("O")
- term.setTextColor(colors.white)
- term.setCursorPos(20,10)
- if read("*") == passContents then
- term.setCursorPos(8,10)
- term.setTextColor(colors.lime)
- term.write("O")
- term.setTextColor(colors.white)
- sleep(0.8)
- term.clear()
- term.setCursorPos(19,9)
- x,y = term.getCursorPos()
- print("Logging in")
- term.setCursorPos(x+10,9)
- sleep(0.7)
- print(".")
- sleep(0.7)
- term.setCursorPos(x+11,9)
- print(".")
- sleep(0.7)
- term.setCursorPos(x+12,9)
- print(".")
- sleep(0.7)
- reset()
- start()
- else
- term.setCursorPos(8,10)
- term.setTextColor(colors.red)
- term.write("X")
- sleep(0.5)
- term.setTextColor(colors.white)
- screen()
- login()
- end
- else
- term.setCursorPos(8,8)
- term.setTextColor(colors.red)
- term.write("X")
- sleep(0.5)
- term.setTextColor(colors.white)
- screen()
- login()
- end
- end
- function settings()
- term.setTextColor(colors.purple)
- frame()
- term.setCursorPos(17,1)
- term.setTextColor(colors.lime)
- print("[EnderOS Settings]")
- term.setCursorPos(7,3)
- print("{Change Username} {Change Password}")
- term.setCursorPos(15,5)
- print("{Change Password Hint}")
- term.setCursorPos(3,1)
- term.setTextColor(colors.orange)
- term.write("[Back]")
- term.setTextColor(colors.white)
- local event, button, xPos, yPos = os.pullEvent("mouse_click")
- if button == 1 then
- if (xPos >=7 and xPos <=23 and yPos == 3) then
- settingsChangeUser()
- elseif (xPos >=27 and xPos <=43 and yPos == 3) then
- settingsChangePass()
- elseif (xPos >=15 and xPos <=36 and yPos == 5) then
- settingsChangeHint()
- elseif (xPos >=3 and xPos <=9 and yPos == 1) then
- start()
- else
- settings()
- end
- else
- sleep(1)--This is to prevent spamming, thus "overloading" EnderOS
- settings()
- end
- end
- function start()
- reset()
- term.setTextColor(colors.purple)
- frame()
- term.setCursorPos(3,19)
- term.setTextColor(colors.orange)
- term.write("[Log Out]")
- term.setCursorPos(17,1)
- term.setTextColor(colors.lime)
- print("[EnderOS Commands]")
- term.setCursorPos(3,3)
- print("{Settings} {Exit}")
- local event, button, xPos, yPos = os.pullEvent("mouse_click")
- if button == 1 then
- if (xPos >=16 and xPos <=21 and yPos == 3) then
- reset()
- elseif (xPos >=3 and xPos <=12 and yPos == 3) then
- settings()
- elseif (xPos >=3 and xPos <=11 and yPos == 19) then
- reset()
- screen()
- login()
- else
- start()
- end
- else
- sleep(1)--This is to prevent spamming, thus "overloading" EnderOS
- start()
- end
- end
- --EnderOS
- os.pullEvent = os.pullEventRaw
- if not term.isColor() then
- term.clear()
- term.setCursorPos(1,1)
- print("EnderOS does not support non-color computers!")
- sleep(3)
- os.shutdown()
- end
- if not fs.exists("/.EnderOS/.EnderOSisInstalled") then
- userInfo()
- end
- reset()
- term.setTextColor(colors.purple)
- term.setCursorPos(13,7)
- print("EnderOS "..version.." Initializing")
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.lime)
- for i = 14,36 do
- term.setCursorPos(i,9)
- term.write(" ")
- sleep(0.3)
- end
- term.setBackgroundColor(colors.black)
- sleep(0.5)
- screen()
- login()
- start()
Advertisement
Add Comment
Please, Sign In to add comment