SHOW:
|
|
- or go back to the newest paste.
| 1 | --License: | |
| 2 | --The code of "EnderOS" in any form is intellectual | |
| 3 | --property of SuicidalSTDz. You may not reproduce, | |
| 4 | --redistribute, or modify it in any way! | |
| 5 | ||
| 6 | --IGNORE! | |
| 7 | --Replace this with your name and anyone else that is allowed on your computer | |
| 8 | playerDetection = false | |
| 9 | allowedPlayers = "SuicidalSTDz","Notch","direwolf20" | |
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | ||
| 16 | ||
| 17 | ||
| 18 | os.pullEvent = os.pullEventRaw | |
| 19 | term.clear() | |
| 20 | term.setCursorPos(1,1) | |
| 21 | if not fs.exists("/.EnderOS/.startupInstalled") then
| |
| 22 | local running = shell.getRunningProgram() | |
| 23 | print("EnderOS has detected a startup file that it clashes with!")
| |
| 24 | print("EnderOS is about to delete this file and install itself in its place")
| |
| 25 | print("Do you wish to continue? Yes or No?")
| |
| 26 | local input = read() | |
| 27 | if input == "Yes" then | |
| 28 | shell.run("delete","startup")
| |
| 29 | fs.move(running, "startup") | |
| 30 | reset() | |
| 31 | print("File removed and EnderOS implanted within the startup file")
| |
| 32 | sleep(5) | |
| 33 | local newStartup = fs.open(".EnderOS/.startupInstalled", "w")
| |
| 34 | newStartup:close() | |
| 35 | else | |
| 36 | os.reboot() | |
| 37 | end | |
| 38 | end | |
| 39 | function settingsChangeUser() | |
| 40 | reset() | |
| 41 | term.setTextColor(colors.orange) | |
| 42 | local passFile = io.open("/.EnderOS/.passInfo", "r")
| |
| 43 | local passContents = passFile:read() | |
| 44 | passFile:close() | |
| 45 | print("Please enter your password: ")
| |
| 46 | if read("*") ~= passContents then
| |
| 47 | print("Invalid password")
| |
| 48 | sleep(1.5) | |
| 49 | settingsChangeUser() | |
| 50 | else | |
| 51 | local user = ("/.EnderOS/.userInfo")
| |
| 52 | io.open(user) | |
| 53 | local username = io.open(user, "w") | |
| 54 | print("Enter new username: ")
| |
| 55 | writeUser = read() | |
| 56 | writeN = username:write(writeUser) | |
| 57 | username:close() | |
| 58 | print("Your new username is "..writeUser)
| |
| 59 | sleep(2) | |
| 60 | start() | |
| 61 | end | |
| 62 | term.setTextColor(colors.white) | |
| 63 | end | |
| 64 | function settingsChangePass() | |
| 65 | reset() | |
| 66 | term.setTextColor(colors.orange) | |
| 67 | local passFile = io.open("/.EnderOS/.passInfo", "r")
| |
| 68 | local passContents = passFile:read() | |
| 69 | passFile:close() | |
| 70 | print("Please enter your password: ")
| |
| 71 | if read("*") ~= passContents then
| |
| 72 | print("Invalid password")
| |
| 73 | sleep(1.5) | |
| 74 | settingsChangePass() | |
| 75 | else | |
| 76 | local pass = ("/.EnderOS/.passInfo")
| |
| 77 | io.open(pass) | |
| 78 | local password = io.open(pass, "w") | |
| 79 | print("Enter new password: ")
| |
| 80 | local writePass = read("*")
| |
| 81 | local writeN = password:write(writePass) | |
| 82 | password:close() | |
| 83 | print("Your new password is "..writePass)
| |
| 84 | sleep(2) | |
| 85 | start() | |
| 86 | end | |
| 87 | term.setTextColor(colors.white) | |
| 88 | end | |
| 89 | function settingsChangeHint() | |
| 90 | reset() | |
| 91 | term.setTextColor(colors.orange) | |
| 92 | local passFile = io.open("/.EnderOS/.passInfo", "r")
| |
| 93 | local passContents = passFile:read() | |
| 94 | passFile:close() | |
| 95 | print("Please enter your password: ")
| |
| 96 | if read("*") ~= passContents then
| |
| 97 | print("Invalid password")
| |
| 98 | sleep(1.5) | |
| 99 | settingsChangeHint() | |
| 100 | else | |
| 101 | local hint = ("/.EnderOS/.userHint")
| |
| 102 | io.open(hint) | |
| 103 | local uHint = io.open(hint, "w") | |
| 104 | print("Enter new hint: ")
| |
| 105 | local writeHint = read("*")
| |
| 106 | local writeN = uHint:write(writeHint) | |
| 107 | uHint:close() | |
| 108 | print("Your new hint is "..writeHint)
| |
| 109 | sleep(2) | |
| 110 | start() | |
| 111 | end | |
| 112 | term.setTextColor(colors.white) | |
| 113 | end | |
| 114 | local version = "v1.8" | |
| 115 | userfile = shell.getRunningProgram() | |
| 116 | local dot = string.byte(shell.getRunningProgram()) | |
| 117 | local v = ".(Period)" | |
| 118 | ||
| 119 | function reset() | |
| 120 | term.clear() | |
| 121 | term.setCursorPos(1,1) | |
| 122 | end | |
| 123 | function userInfo() | |
| 124 | reset() | |
| 125 | fs.makeDir("/.EnderOS/")
| |
| 126 | user = ("/.EnderOS/.userInfo")
| |
| 127 | io.open(user) | |
| 128 | username = io.open(user, "w") | |
| 129 | print("Please enter your desired Username")
| |
| 130 | writeUser = read() | |
| 131 | writeIsFailUser = username:write(writeUser) | |
| 132 | username:close() | |
| 133 | pass = ("/.EnderOS/.passInfo")
| |
| 134 | io.open(pass) | |
| 135 | password = io.open(pass, "w") | |
| 136 | print("Please enter your desired Password")
| |
| 137 | writePass = read("*")
| |
| 138 | writeIsFailPass = password:write(writePass) | |
| 139 | password:close() | |
| 140 | hint = ("/.EnderOS/.userHint")
| |
| 141 | io.open(hint) | |
| 142 | uHint = io.open(hint, "w") | |
| 143 | print("Please enter your desired Password hint")
| |
| 144 | writeHint = read() | |
| 145 | writeIsFailHint = uHint:write(writeHint) | |
| 146 | uHint:close() | |
| 147 | local installC = fs.open("/.EnderOS/.EnderOSisInstalled", "w")
| |
| 148 | installC:close() | |
| 149 | end | |
| 150 | function frame() | |
| 151 | print("+-------------------------------------------------+")
| |
| 152 | for i = 1,17 do | |
| 153 | print("| |")
| |
| 154 | end | |
| 155 | term.write("+-------------------------------------------------+")
| |
| 156 | end | |
| 157 | function no() | |
| 158 | term.clear() | |
| 159 | term.setTextColor(colors.red) | |
| 160 | term.setCursorPos(1,1) | |
| 161 | print("Sorry, I have not coded this in yet. Please be patient.")
| |
| 162 | sleep(3) | |
| 163 | end | |
| 164 | function screen() | |
| 165 | reset() | |
| 166 | term.setTextColor(colors.lime) | |
| 167 | print("+-------------------------------------------------+")
| |
| 168 | print("| |")
| |
| 169 | print("| ")
| |
| 170 | term.setCursorPos(19,3) | |
| 171 | term.setTextColor(colors.purple) | |
| 172 | write("EnderOS "..version)
| |
| 173 | term.setTextColor(colors.lime) | |
| 174 | term.setCursorPos(31,3) | |
| 175 | print(" |")
| |
| 176 | print("| |")
| |
| 177 | print("| |")
| |
| 178 | print("| |")
| |
| 179 | print("| |")
| |
| 180 | print("| ")
| |
| 181 | term.setCursorPos(10,8) | |
| 182 | term.setTextColor(colors.orange) | |
| 183 | print("Username:")
| |
| 184 | term.setCursorPos(19,8) | |
| 185 | print(" ")
| |
| 186 | term.setCursorPos(50,8) | |
| 187 | term.setTextColor(colors.lime) | |
| 188 | print(" |")
| |
| 189 | print("| |")
| |
| 190 | print("| ")
| |
| 191 | term.setTextColor(colors.orange) | |
| 192 | term.setCursorPos(10,10) | |
| 193 | print("Password:")
| |
| 194 | term.setCursorPos(19,10) | |
| 195 | print(" ")
| |
| 196 | term.setCursorPos(50,10) | |
| 197 | term.setTextColor(colors.lime) | |
| 198 | print(" |")
| |
| 199 | print("| |")
| |
| 200 | print("| |")
| |
| 201 | print("| ")
| |
| 202 | term.setCursorPos(8,13) | |
| 203 | term.setTextColor(colors.blue) | |
| 204 | print("forgot password ")
| |
| 205 | term.setCursorPos(50,13) | |
| 206 | term.setTextColor(colors.lime) | |
| 207 | print(" |")
| |
| 208 | print("| |")
| |
| 209 | print("| |")
| |
| 210 | print("| |")
| |
| 211 | print("| |")
| |
| 212 | print("| |")
| |
| 213 | write("+-------------------------------------------------+")
| |
| 214 | end | |
| 215 | function click() | |
| 216 | local userHint = io.open("/.EnderOS/.userHint", "r")
| |
| 217 | hintContents = userHint:read() | |
| 218 | userHint:close() | |
| 219 | local event, button, xPos, yPos = os.pullEvent("mouse_click")
| |
| 220 | if button == 1 then | |
| 221 | if (xPos >=8 and xPos <=22 and yPos == 13) then | |
| 222 | term.setCursorPos(10,15) | |
| 223 | term.setTextColor(colors.red) | |
| 224 | print("Hint: "..hintContents)
| |
| 225 | term.setTextColor(colors.white) | |
| 226 | click() | |
| 227 | elseif (xPos >=10 and xPos <=18 and yPos == 8) then | |
| 228 | term.setCursorPos(20,8) | |
| 229 | else | |
| 230 | screen() | |
| 231 | click() | |
| 232 | end | |
| 233 | else | |
| 234 | click() | |
| 235 | end | |
| 236 | end | |
| 237 | function login() | |
| 238 | click() | |
| 239 | local userFile = io.open("/.EnderOS/.userInfo", "r")
| |
| 240 | userContents = userFile:read() | |
| 241 | userFile:close() | |
| 242 | local passFile = io.open("/.EnderOS/.passInfo", "r")
| |
| 243 | passContents = passFile:read() | |
| 244 | passFile:close() | |
| 245 | term.setTextColor(colors.white) | |
| 246 | if read() == userContents then | |
| 247 | term.setCursorPos(8,8) | |
| 248 | term.setTextColor(colors.lime) | |
| 249 | term.write("O")
| |
| 250 | term.setTextColor(colors.white) | |
| 251 | term.setCursorPos(20,10) | |
| 252 | if read("*") == passContents then
| |
| 253 | term.setCursorPos(8,10) | |
| 254 | term.setTextColor(colors.lime) | |
| 255 | term.write("O")
| |
| 256 | term.setTextColor(colors.white) | |
| 257 | sleep(0.8) | |
| 258 | term.clear() | |
| 259 | term.setCursorPos(19,9) | |
| 260 | x,y = term.getCursorPos() | |
| 261 | print("Logging in")
| |
| 262 | term.setCursorPos(x+10,9) | |
| 263 | sleep(0.7) | |
| 264 | print(".")
| |
| 265 | sleep(0.7) | |
| 266 | term.setCursorPos(x+11,9) | |
| 267 | print(".")
| |
| 268 | sleep(0.7) | |
| 269 | term.setCursorPos(x+12,9) | |
| 270 | print(".")
| |
| 271 | sleep(0.7) | |
| 272 | reset() | |
| 273 | start() | |
| 274 | else | |
| 275 | term.setCursorPos(8,10) | |
| 276 | term.setTextColor(colors.red) | |
| 277 | term.write("X")
| |
| 278 | sleep(0.5) | |
| 279 | term.setTextColor(colors.white) | |
| 280 | screen() | |
| 281 | login() | |
| 282 | end | |
| 283 | else | |
| 284 | term.setCursorPos(8,8) | |
| 285 | term.setTextColor(colors.red) | |
| 286 | term.write("X")
| |
| 287 | sleep(0.5) | |
| 288 | term.setTextColor(colors.white) | |
| 289 | screen() | |
| 290 | login() | |
| 291 | end | |
| 292 | end | |
| 293 | function settings() | |
| 294 | term.setTextColor(colors.purple) | |
| 295 | frame() | |
| 296 | term.setCursorPos(17,1) | |
| 297 | term.setTextColor(colors.lime) | |
| 298 | print("[EnderOS Settings]")
| |
| 299 | term.setCursorPos(7,3) | |
| 300 | print("{Change Username} {Change Password}")
| |
| 301 | term.setCursorPos(15,5) | |
| 302 | print("{Change Password Hint}")
| |
| 303 | term.setCursorPos(3,1) | |
| 304 | term.setTextColor(colors.orange) | |
| 305 | term.write("[Back]")
| |
| 306 | term.setTextColor(colors.white) | |
| 307 | local event, button, xPos, yPos = os.pullEvent("mouse_click")
| |
| 308 | if button == 1 then | |
| 309 | if (xPos >=7 and xPos <=23 and yPos == 3) then | |
| 310 | settingsChangeUser() | |
| 311 | elseif (xPos >=27 and xPos <=43 and yPos == 3) then | |
| 312 | settingsChangePass() | |
| 313 | elseif (xPos >=15 and xPos <=36 and yPos == 5) then | |
| 314 | settingsChangeHint() | |
| 315 | elseif (xPos >=3 and xPos <=9 and yPos == 1) then | |
| 316 | start() | |
| 317 | else | |
| 318 | settings() | |
| 319 | end | |
| 320 | else | |
| 321 | sleep(1)--This is to prevent spamming, thus "overloading" EnderOS | |
| 322 | settings() | |
| 323 | end | |
| 324 | end | |
| 325 | function start() | |
| 326 | reset() | |
| 327 | term.setTextColor(colors.purple) | |
| 328 | frame() | |
| 329 | term.setCursorPos(3,19) | |
| 330 | term.setTextColor(colors.orange) | |
| 331 | term.write("[Log Out]")
| |
| 332 | term.setCursorPos(17,1) | |
| 333 | term.setTextColor(colors.lime) | |
| 334 | print("[EnderOS Commands]")
| |
| 335 | term.setCursorPos(3,3) | |
| 336 | print("{Settings} {Exit}")
| |
| 337 | local event, button, xPos, yPos = os.pullEvent("mouse_click")
| |
| 338 | if button == 1 then | |
| 339 | if (xPos >=16 and xPos <=21 and yPos == 3) then | |
| 340 | reset() | |
| 341 | elseif (xPos >=3 and xPos <=12 and yPos == 3) then | |
| 342 | settings() | |
| 343 | elseif (xPos >=3 and xPos <=11 and yPos == 19) then | |
| 344 | reset() | |
| 345 | screen() | |
| 346 | login() | |
| 347 | else | |
| 348 | start() | |
| 349 | end | |
| 350 | else | |
| 351 | sleep(1)--This is to prevent spamming, thus "overloading" EnderOS | |
| 352 | start() | |
| 353 | end | |
| 354 | end | |
| 355 | ||
| 356 | ||
| 357 | - | end |
| 357 | + | |
| 358 | if not term.isColor() then | |
| 359 | term.clear() | |
| 360 | term.setCursorPos(1,1) | |
| 361 | print("EnderOS does not support non-color computers!")
| |
| 362 | sleep(3) | |
| 363 | os.shutdown() | |
| 364 | end | |
| 365 | if not fs.exists("/.EnderOS/.EnderOSisInstalled") then
| |
| 366 | userInfo() | |
| 367 | end | |
| 368 | reset() | |
| 369 | term.setTextColor(colors.purple) | |
| 370 | term.setCursorPos(13,7) | |
| 371 | print("EnderOS "..version.." Initializing")
| |
| 372 | term.setTextColor(colors.white) | |
| 373 | term.setBackgroundColor(colors.lime) | |
| 374 | for i = 14,36 do | |
| 375 | term.setCursorPos(i,9) | |
| 376 | term.write(" ")
| |
| 377 | sleep(0.3) | |
| 378 | end | |
| 379 | term.setBackgroundColor(colors.black) | |
| 380 | sleep(0.5) | |
| 381 | screen() | |
| 382 | login() | |
| 383 | start() |