Advertisement
joshgreatuk

LUAOS Startup 0.4.5 Indev

Jul 30th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.24 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. function pi(eid,t)
  3. term.clear()
  4. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  5. paintutils.drawBox(1,1,51,19,colors.blue)
  6. term.setBackgroundColor(colors.lightBlue)
  7. term.setCursorPos(3,3)
  8. print("enter a pastebin code or enter exit to exit")
  9. term.setCursorPos(3,5)
  10. pcode = read()
  11. if pcode == "exit" then
  12. ag(eid,t)
  13. end
  14. term.setCursorPos(3,7)
  15. print("enter a name for this code or enter exit to exit")
  16. term.setCursorPos(3,9)
  17. ncode = read()
  18. if ncode == "exit" then
  19. ag(eid,t)
  20. end
  21. scmd = "pastebin get "..pcode.." /LUAOS/C/Programs/"..ncode
  22. shell.run(scmd)
  23. sleep(1)
  24. ag(eid,t)
  25. end
  26. function pl(eid,t)
  27. term.clear()
  28. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  29. paintutils.drawFilledBox(1,1,51,3,colors.blue)
  30. paintutils.drawLine(2,2,50,2,colors.lightBlue)
  31. paintutils.drawLine(1,19,51,19,colors.blue)
  32. term.setBackgroundColor(colors.blue)
  33. term.setCursorPos(1,1)
  34. print("LUAOS App Library")
  35. local x1,y1 = 48,1
  36. local x2,y2 = 25,1
  37. local x3,y3 = 35,1
  38. local choice1 = "Exit"
  39. local choice2 = "Refresh"
  40. local choice3 = "Run"
  41. term.setCursorPos(x1,y1)
  42. write(choice1)
  43. term.setCursorPos(x2,y2)
  44. write(choice2)
  45. term.setCursorPos(x3,y3)
  46. write(choice3)
  47. while true do
  48. local event, button, cx, cy = os.pullEvent()
  49. if event == "mouse_click" then
  50. if cx >= x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
  51. ag(eid,t)
  52. break
  53. else if cx >= x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
  54. dir = "LUAOS/C/Programs/"
  55. term.setBackgroundColor(colors.lightBlue)
  56. term.setCursorPos(1,4)
  57. local filelist = fs.list(dir)
  58. for _, file in ipairs(filelist) do
  59. print(file)
  60. end
  61. else if cx >= x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
  62. term.setCursorPos(2,2)
  63. term.setBackgroundColor(colors.lightBlue)
  64. print("File:")
  65. term.setCursorPos(7,2)
  66. run = read()
  67. frun = "/LUAOS/C/Programs/"..run
  68. if not fs.exists(frun) then
  69. term.setBackgroundColor(colors.blue)
  70. term.setCursorPos(2,3)
  71. print("program does not exist")
  72. sleep(3)
  73. pl(eid,t)
  74. break
  75. end
  76. shell.openTab(frun)
  77. pl(eid,t)
  78. end
  79. end
  80. end
  81. end
  82. end
  83. end
  84. function ad(app,eid,t)
  85. term.clear()
  86. if app == "network_manager" then
  87. term.clear()
  88. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  89. paintutils.drawLine(1,1,51,1,colors.blue)
  90. term.setBackgroundColor(colors.blue)
  91. term.setCursorPos(1,1)
  92. print("Download : "..app)
  93. local x1, y1 = 48,1
  94. local x2, y2 = 44,19
  95. local choice1 = "Exit"
  96. local choice2 = "Download"
  97. term.setBackgroundColor(colors.lightBlue)
  98. term.setCursorPos(1,3)
  99. print("Network Manager:")
  100. term.setCursorPos(1,5)
  101. print("Can be used to control a network of computers with an ender/wireless modem on top (NOTE:The modem must be on top of the computer otherwise this wont work). Can be used with server manager to create a network for a building or bigger")
  102. term.setBackgroundColor(colors.blue)
  103. term.setCursorPos(x1,y1)
  104. write(choice1)
  105. term.setBackgroundColor(colors.red)
  106. term.setCursorPos(x2,y2)
  107. write(choice2)
  108. while true do
  109. local event, button, cx, cy = os.pullEvent()
  110. if event == "mouse_click" then
  111. if cx >= x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
  112. as(eid,t)
  113. else if cx >= x2 and cx < x2 + choice2:len() and cy == y1 and button == 1 then
  114. -- add download here
  115. end
  116. end
  117. end
  118. end
  119. else if app == "red_alert" then
  120. term.clear()
  121. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  122. paintutils.drawLine(1,1,51,1,colors.blue)
  123. term.setBackgroundColor(colors.blue)
  124. term.setCursorPos(1,1)
  125. print("Download : "..app)
  126. local x1, y1 = 48,1
  127. local x2, y2 = 44,19
  128. local choice1 = "Exit"
  129. local choice2 = "Download"
  130. term.setBackgroundColor(colors.lightBlue)
  131. term.setCursorPos(1,3)
  132. print("Red Alert:")
  133. term.setCursorPos(1,5)
  134. print("Used to control redstone with a wireless network (NOTE : put an ender/wireless modem on top for it to work)")
  135. term.setBackgroundColor(colors.blue)
  136. term.setCursorPos(x1,y1)
  137. write(choice1)
  138. term.setBackgroundColor(colors.red)
  139. term.setCursorPos(x2,y2)
  140. write(choice2)
  141. while true do
  142. local event, button, cx, cy = os.pullEvent()
  143. if event == "mouse_click" then
  144. if cx >= x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
  145. as(eid,t)
  146. else if cx >= x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
  147. shell.run("pastebin get 5MacHzW9 /LUAOS/C/Programs/red_alert_installer")
  148. term.setCursorPos(1,49)
  149. print("red_alert Installed")
  150. as(eid,t)
  151. end
  152. end
  153. end
  154. end
  155. end
  156. end
  157. end
  158. function as(eid,t)
  159. term.clear()
  160. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  161. paintutils.drawLine(1,1,51,1,colors.blue)
  162. term.setBackgroundColor(colors.blue)
  163. term.setCursorPos(1,1)
  164. print("LUAOS App Store")
  165. local choice1 = "Exit"
  166. local choice2 = "Download"
  167. local x1, y1 = 48,1
  168. local x2, y2 = 44,2
  169. local x3, y3 = 44,3
  170. term.setCursorPos(x1,y1)
  171. write(choice1)
  172. term.setBackgroundColor(colors.red)
  173. term.setCursorPos(x2,y2)
  174. write(choice2)
  175. term.setCursorPos(x3,y3)
  176. write(choice2)
  177. term.setBackgroundColor(colors.lightBlue)
  178. term.setCursorPos(1,2)
  179. print("Network Manager:Manages Networks")
  180. term.setCursorPos(1,3)
  181. print("Red Alert:Manages Redstone")
  182. while true do
  183. local event, button, cx, cy = os.pullEvent()
  184. if event == "mouse_click" then
  185. if cx >= x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
  186. ag(eid,t)
  187. break
  188. else if cx >= x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
  189. ad("network_manager",eid,t)
  190. break
  191. else if cx >= x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
  192. ad("red_alert",eid,t)
  193. break
  194. end
  195. end
  196. end
  197. end
  198. end
  199. end
  200. function ag(eid,t)
  201. term.clear()
  202. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  203. paintutils.drawBox(1,1,51,19,colors.blue)
  204. term.setBackgroundColor(colors.lightBlue)
  205. if not fs.exists("/LUAOS/C/Programs") then
  206. term.setCursorPos(3,3)
  207. print("The LUAOS games and apps program is not")
  208. term.setCursorPos(3,4)
  209. print("installed ,do you want to install it now")
  210. term.setCursorPos(3,6)
  211. print("Y/N")
  212. local sevemt, param = os.pullEvent("key")
  213. if param == 21 then
  214. term.setCursorPos(3,8)
  215. print("installing now")
  216. fs.makeDir("/LUAOS/C/Programs")
  217. term.setCursorPos(3,10)
  218. print("installed")
  219. sleep(5)
  220. ag(eid,t)
  221. else if param == 49 then
  222. li(eid,t)
  223. else
  224. ag(eid,t)
  225. end
  226. end
  227. end
  228. term.clear()
  229. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  230. paintutils.drawBox(1,1,51,19,colors.blue)
  231. term.setBackgroundColor(colors.lightBlue)
  232. term.setCursorPos(3,3)
  233. print("Select the option you with to choose")
  234. choice1 = " App Store "
  235. choice2 = " Exit "
  236. choice3 = " Program Library "
  237. choice4 = " Pastebin Installer "
  238. local x1, y1 = 3,5
  239. local x2, y2 = 3,7
  240. local x3, y3 = 3,9
  241. local x4, y4 = 3,11
  242. term.setBackgroundColor(colors.red)
  243. term.setCursorPos(x1,y1)
  244. write(choice1)
  245. term.setCursorPos(x2,y2)
  246. write(choice2)
  247. term.setCursorPos(x3,y3)
  248. write(choice3)
  249. term.setCursorPos(x4,y4)
  250. write(choice4)
  251. while true do
  252. local event, button, cx, cy = os.pullEvent()
  253. if event == "mouse_click" then
  254. if cx >= x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
  255. as(eid,t)
  256. break
  257. else if cx >= x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
  258. li(eid,t)
  259. break
  260. else if cx >= x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
  261. pl(eid,t)
  262. break
  263. else if cx >= x4 and cx < x4 + choice4:len() and cy == y4 and button == 1 then
  264. pi(eid,t)
  265. break
  266. end
  267. end
  268. end
  269. end
  270. end
  271. end
  272. end
  273. function ac1(eid,t)
  274. term.clear()
  275. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  276. paintutils.drawBox(1,1,51,19,colors.blue)
  277. term.setBackgroundColor(colors.lightBlue)
  278. term.setCursorPos(3,3)
  279. print("Please type an ID to create or type exit")
  280. term.setCursorPos(3,5)
  281. print("ID:")
  282. term.setCursorPos(6,5)
  283. nid = read()
  284. if nid == "exit" then
  285. ac(eid,t)
  286. end
  287. term.setCursorPos(3,7)
  288. fs.makeDir("/LUAOS/S/Users/"..nid)
  289. term.setCursorPos(3,9)
  290. print("Now type a username and password")
  291. term.setCursorPos(3,11)
  292. print("Username:")
  293. term.setCursorPos(12,11)
  294. nu = read()
  295. term.setCursorPos(3,13)
  296. print("Password:")
  297. term.setCursorPos(12,13)
  298. np = read()
  299. eu = nid.."user"
  300. ep = nid.."pass"
  301. nu = enc.encrypt(nu,eu)
  302. np = enc.encrypt(np,ep)
  303. f = fs.open("/LUAOS/S/Users/"..nid.."/u","w")
  304. f.write(nu)
  305. f.close()
  306. f = fs.open("/LUAOS/S/Users/"..nid.."/p","w")
  307. f.write(np)
  308. f.close()
  309. term.setCursorPos(3,15)
  310. print("finally time to enter the user's")
  311. term.setCursorPos(3,16)
  312. print("level of permission (a / n)")
  313. term.setCursorPos(3,18)
  314. print("Permission level:")
  315. term.setCursorPos(20,18)
  316. nt = read()
  317. if not nt == "a" and not nt == "n" then
  318. term.clear()
  319. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  320. paintutils.drawBox(1,1,51,19,colors.blue)
  321. term.setBackgroundColor(colors.lightBlue)
  322. term.setCursorPos(3,3)
  323. print("invalid permission level")
  324. sleep(5)
  325. ac(eid,t)
  326. end
  327. et = nid.."perm"
  328. nt = enc.encrypt(nt,et)
  329. f= fs.open("/LUAOS/S/Users/"..nid.."/t","w")
  330. f.write(nt)
  331. f.close()
  332. term.clear()
  333. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  334. paintutils.drawBox(1,1,51,19,colors.blue)
  335. term.setBackgroundColor(colors.lightBlue)
  336. term.setCursorPos(3,3)
  337. print("Account created")
  338. sleep(5)
  339. ac(eid,t)
  340. end
  341. function ac2(eid,t)
  342. term.clear()
  343. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  344. paintutils.drawBox(1,1,51,19,colors.blue)
  345. term.setBackgroundColor(colors.lightBlue)
  346. term.setCursorPos(3,3)
  347. print("enter an ID to delete")
  348. term.setCursorPos(3,5)
  349. print("ID:")
  350. term.setCursorPos(6,5)
  351. did = read()
  352. did1 = "/LUAOS/S/Users/"..did
  353. if not fs.exists(did1) then
  354. term.setCursorPos(3,7)
  355. print("Invalid ID")
  356. sleep(5)
  357. ac(eid,t)
  358. end
  359. fs.delete(did1)
  360. term.clear()
  361. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  362. paintutils.drawBox(1,1,51,19,colors.blue)
  363. term.setBackgroundColor(colors.lightBlue)
  364. term.setCursorPos(3,3)
  365. print("Account deleted")
  366. sleep(5)
  367. ac(eid,t)
  368. end
  369. function fb(dir,eid,t)
  370. term.setTextColor(colors.red)
  371. print("directory:",dir)
  372. print("type a command")
  373. cmd = read()
  374. if cmd == "cd" then
  375. print("enter a directory to go to")
  376. ed = read()
  377. ede = dir.."/"..ed
  378. if not fs.exists(ede) then
  379. print("directory not found")
  380. fb(dir,eid,t)
  381. else if ed == "/" then
  382. dir = "/"
  383. fb(dir,eid,t)
  384. else if dir == "/" then
  385. dir = "/"..ed
  386. fb(dir,eid,t)
  387. end
  388. end
  389. end
  390. dir = ede
  391. fb(dir,eid,t)
  392. else if cmd == "ls" then
  393. local filelist = fs.list(dir)
  394. for _, file in ipairs(filelist) do
  395. print(file)
  396. end
  397. fb(dir,eid,t)
  398. else if cmd == "exit" then
  399. li(eid,t)
  400. else if cmd == "run" then
  401. print("enter a program directory to run")
  402. run = read()
  403. rune = dir..run
  404. if rune == "" then
  405. print("invalid program")
  406. fb(dir,eid,t)
  407. end
  408. shell.openTab(rune)
  409. else if cmd == "help" then
  410. print("help guide:")
  411. print("cd: This command moves your directory to what you enter, if you enter '/' then it will put you at the directory /LUAOS")
  412. print("ls: This command will tell you all the files in your current directory")
  413. print("exit: This command will make you exit back to the LUAOS menu")
  414. print("run: This command will run any program in your current directory that you type as long as it is real")
  415. print("help: This command will bring up this help guide")
  416. print("move: This command will move an entered file in the current directory to an entered directory")
  417. print("delete: This command will delete an entered file in the current directory")
  418. fb(eid,t)
  419. else if cmd == "move" then
  420. print("enter the file to move in your current directory")
  421. file = read()
  422. filee = dir.."/"..file
  423. if not fs.exists(filee) then
  424. print("file does not exist")
  425. fb(dir,eid,t)
  426. end
  427. print("enter the directory to move the file to (must be a full directory e.g /LUAOS/C/Programs/)")
  428. fmd = read()
  429. if not fs.exists(fmd) then
  430. print("directory does not exist")
  431. fb(dir,eid,t)
  432. end
  433. fs.move(filee,fmd)
  434. fb(dir,eid,t)
  435. else if cmd == "delete" then
  436. print("enter the file in the current directory to delete")
  437. fdel = read()
  438. fdele = dir.."/"..fdele
  439. if not fs.exists(fdele) then
  440. print("file does not exist")
  441. fb(dir,eid,t)
  442. end
  443. if fdele == "/LUAOS" or fdele == "/LUAOS/S" or fdele == "/LUAOS/S/Users" or fdele == "/LUAOS/S/Users/1" or fdele == "/LUAOS/C" then
  444. print("access denied")
  445. fb(dir,eid,t)
  446. end
  447. else if cmd == "edit" then
  448. print("enter a file in your current directory to edit")
  449. fe = read()
  450. scmd = "edit "..dir..fe
  451. shell.run(scmd)
  452. fb(dir,eid,t)
  453. else
  454. print("invalid command. Type 'help' to see all the commands")
  455. fb(dir,eid,t)
  456. end
  457. end
  458. end
  459. end
  460. end
  461. end
  462. end
  463. end
  464. end
  465. function ac(eid,t)
  466. term.clear()
  467. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  468. paintutils.drawBox(1,1,51,19,colors.blue)
  469. term.setBackgroundColour(colors.lightBlue)
  470. local x1, y1 = 3,5
  471. local x2, y2 = 3,7
  472. local x3, y3 = 3,9
  473. local choice1 = " Add Account "
  474. local choice2 = " Delete Account "
  475. local choice3 = " Exit "
  476. term.setCursorPos(3,3)
  477. print("Welcome to LUAOS account control")
  478. term.setBackgroundColor(colors.red)
  479. term.setCursorPos(x1,y1)
  480. write(choice1)
  481. term.setCursorPos(x2,y2)
  482. write(choice2)
  483. term.setCursorPos(x3,y3)
  484. write(choice3)
  485. while true do
  486. local event, button, cx, cy = os.pullEvent()
  487. if event == "mouse_click" then
  488. if cx >= x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
  489. term.clear()
  490. ac1(eid,t)
  491. break
  492. end
  493. if cx >= x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
  494. term.clear()
  495. ac2(eid,t)
  496. break
  497. end
  498. if cx >= x3 and cx < x1 + choice3:len() and cy == y3 and button == 1 then
  499. term.clear()
  500. li(eid,t)
  501. break
  502. end
  503. end
  504. end
  505. end
  506. function ud(v,eid,t)
  507. shell.run("pastebin get AC6USdEP version")
  508. term.clear()
  509. term.setCursorPos(3,3)
  510. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  511. paintutils.drawBox(1,1,51,19,colors.blue)
  512. term.setBackgroundColor(colors.lightBlue)
  513. f = fs.open("/version", "r")
  514. v = 0.45
  515. nv = tonumber(f.readAll())
  516. f.close()
  517. term.clear()
  518. term.setCursorPos(3,3)
  519. print("LUAOS version:"..v)
  520. print("the newest version of LUAOS is:"..nv)
  521. sleep(3)
  522. if nv > v then
  523. u = true
  524. else
  525. u = false
  526. end
  527. if u == true then
  528. term.setCursorPos(3,5)
  529. print("updating now")
  530. shell.run("pastebin get WnjNK63g version1")
  531. f = fs.open("/version1", "r")
  532. pb = f.readAll()
  533. f.close()
  534. shell.run("pastebin get ", pb, " LUAOSinstall")
  535. dofile("/LUAOSinstall")
  536. else
  537. print("your version of LUAOS is up to date")
  538. fs.delete("/version")
  539. if fs.exists("/version1") then
  540. fs.delete("/version1")
  541. end
  542. sleep(5)
  543. li(eid, t)
  544. end
  545. end
  546. function li(eid,t)
  547. term.clear()
  548. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  549. paintutils.drawBox(1,1,51,19,colors.blue)
  550. term.setBackgroundColor(colors.lightBlue)
  551. term.setCursorPos(4,3)
  552. term.setTextColor(colors.white)
  553. print("Welcome to the LUAOS Indev 0.4.5 Menu")
  554. local x1, y1 = 4,5
  555. local x2, y2 = 4,7
  556. local x3, y3 = 4,9
  557. local x4, y4 = 4,11
  558. local x5, y5 = 4,13
  559. local x6, y6 = 4,15
  560. local x7, y7 = 4,17
  561. local choice1 = " Shutdown "
  562. local choice2 = " Restart "
  563. local choice3 = " Sign Out "
  564. local choice4 = " File Browser "
  565. local choice5 = " Account Control "
  566. local choice6 = " Update "
  567. local choice7 = " Apps/Games "
  568. term.setBackgroundColor(colors.red)
  569. term.setCursorPos(x1,y1)
  570. write(choice1)
  571. term.setCursorPos(x2,y2)
  572. write(choice2)
  573. term.setCursorPos(x3,y3)
  574. write(choice3)
  575. term.setCursorPos(x4,y4)
  576. write(choice4)
  577. term.setCursorPos(x5,y5)
  578. write(choice5)
  579. term.setCursorPos(x6,y6)
  580. write(choice6)
  581. term.setCursorPos(x7,y7)
  582. write(choice7)
  583. while true do
  584. local event, button, cx, cy = os.pullEvent()
  585. if event == "mouse_click" then
  586. if cx >= x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
  587. os.shutdown()
  588. break
  589. else if cx >= x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
  590. os.reboot()
  591. break
  592. else if cx >= x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
  593. boot()
  594. break
  595. else if cx >= x4 and cx < x4 + choice4:len() and cy == y4 and button == 1 then
  596. term.clear()
  597. paintutils.drawFilledBox(1,1,51,19,colors.black)
  598. term.setCursorPos(1,1)
  599. fb("/LUAOS/C",eid,t)
  600. break
  601. else if cx >= x5 and cx < x5 + choice5:len() and cy == y5 and button == 1 then
  602. ac(eid,t)
  603. break
  604. else if cx >= x6 and cx < x6 + choice6:len() and cy == y6 and button == 1 then
  605. ud(eid,t)
  606. break
  607. else if cx >= x7 and cx < x7 + choice7:len() and cy == y7 and button == 1 then
  608. ag(eid,t)
  609. end
  610. end
  611. end
  612. end
  613. end
  614. end
  615. end
  616. end
  617. end
  618. end
  619. function uc1()
  620. term.clear()
  621. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  622. paintutils.drawBox(1,1,51,19,colors.blue)
  623. term.setBackgroundColor(colors.lightBlue)
  624. term.setTextColor(colors.white)
  625. term.setCursorPos(3,3)
  626. print("welcome to the LUAOS first user setup")
  627. term.setCursorPos(3,4)
  628. print("your first user will be an administrator")
  629. term.setCursorPos(3,5)
  630. print("administrators can edit and add users")
  631. term.setCursorPos(3,6)
  632. print("while normal users cant, administrators")
  633. term.setCursorPos(3,7)
  634. print("can also install apps onto the PC but")
  635. term.setCursorPos(3,8)
  636. print("normal users also can if they have their")
  637. term.setCursorPos(3,9)
  638. print("administrators password.The ID of this")
  639. term.setCursorPos(3,10)
  640. print("account will be '1'")
  641. term.setCursorPos(3,11)
  642. print("press enter to create your account.")
  643. back = read()
  644. term.clear()
  645. term.setCursorPos(3,3)
  646. print("Now to make your administrator account")
  647. term.setCursorPos(3,5)
  648. print("Username:")
  649. term.setCursorPos(3,6)
  650. print("Password:")
  651. term.setCursorPos(12,5)
  652. nu = read()
  653. term.setCursorPos(12,6)
  654. np = read("*")
  655. nu = enc.encrypt(nu,"1user")
  656. np = enc.encrypt(np,"1pass")
  657. t = enc.encrypt(t,"1perm")
  658. fs.makeDir("/LUAOS/S/Users/1")
  659. f = fs.open("/LUAOS/S/Users/1/u", "w")
  660. f.write(nu)
  661. f.close()
  662. f = fs.open("/LUAOS/S/Users/1/p", "w")
  663. f.write(np)
  664. f.close()
  665. f = fs.open("/LUAOS/S/Users/1/t", "w")
  666. f.write(t)
  667. f.close()
  668. term.setCursorPos(3,8)
  669. print("Your new account has been made!")
  670. term.setCursorPos(3,9)
  671. print("Restarting now!")
  672. sleep(5)
  673. os.reboot()
  674. end
  675. function boot()
  676. term.clear()
  677. if not fs.exists("LUAOS/S/Users/1") then
  678. uc1()
  679. end
  680. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  681. paintutils.drawBox(1,1,51,19,colors.blue)
  682. term.setTextColor(colors.white)
  683. term.setBackgroundColor(colors.lightBlue)
  684. term.setCursorPos(3,3)
  685. print("Welcome to LUAOS login")
  686. term.setCursorPos(3,6)
  687. print("Enter your ID to contine")
  688. term.setCursorPos(3,9)
  689. eid = read()
  690. if not fs.exists("LUAOS/S/Users/"..eid) then
  691. term.clear()
  692. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  693. paintutils.drawBox(1,1,51,19,colors.blue)
  694. term.setBackgroundColor(colors.lightBlue)
  695. term.setCursorPos(3,3)
  696. print("Your ID is invalid, it may not exist")
  697. sleep(5)
  698. term.setCursorPos(3,5)
  699. print("Do you want to shutdown?, Y/N")
  700. local sEvent, param = os.pullEvent("key")
  701. if param == 21 then
  702. os.shutdown()
  703. else
  704. boot()
  705. end
  706. else if eid == "" then
  707. term.clear()
  708. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  709. paintutils.drawBox(1,1,51,19,colors.blue)
  710. term.setBackgroundColor(colors.lightBlue)
  711. term.setCursorPos(3,3)
  712. print("Your ID is invalid, it may not exist")
  713. sleep(5)
  714. term.setCursorPos(3,5)
  715. print("Do you want to shutdown?, Y/N")
  716. local sEvent, param = os.pullEvent("key")
  717. if param == 21 then
  718. os.shutdown()
  719. else
  720. boot()
  721. end
  722. end
  723. end
  724. term.clear()
  725. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  726. paintutils.drawBox(1,1,51,19,colors.blue)
  727. term.setBackgroundColor(colors.lightBlue)
  728. term.setCursorPos(3,3)
  729. print("Now login to your account")
  730. term.setCursorPos(3,6)
  731. print("Username:")
  732. term.setCursorPos(3,8)
  733. print("Password:")
  734. term.setCursorPos(12,6)
  735. eu = read()
  736. term.setCursorPos(12,8)
  737. ep = read("*")
  738. dir1 = "/LUAOS/S/Users/"..eid.."/u"
  739. dir2 = "/LUAOS/S/Users/"..eid.."/p"
  740. dir3 = "/LUAOS/S/Users/"..eid.."/t"
  741. fu = fs.open(dir1,"r")
  742. ru = fu.readAll()
  743. fu.close()
  744. fp = fs.open(dir2,"r")
  745. rp = fp.readAll()
  746. fp.close()
  747. ft = fs.open(dir3,"r")
  748. t = ft.readAll()
  749. ft.close()
  750. eu1 = eid.."user"
  751. ep1 = eid.."pass"
  752. et1 = eid.."perm"
  753. ru = enc.decrypt(ru,eu1)
  754. rp = enc.decrypt(rp,ep1)
  755. t = enc.decrypt(t,et1)
  756. if eu == ru and ep == rp then
  757. term.setCursorPos(3,11)
  758. print("Welcome to LUAOS",ru)
  759. sleep(5)
  760. li(eid,t)
  761. else
  762. term.setCursorPos(3,11)
  763. print("Incorrect username and/or password")
  764. print("Do you want to shutdown?, Y/N")
  765. local sEvent, param = os.pullEvent("key")
  766. if param == 21 then
  767. os.shutdown()
  768. else
  769. boot()
  770. end
  771. end
  772. end
  773. function recovery()
  774. term.clear()
  775. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  776. paintutils.drawBox(1,1,51,19,colors.blue)
  777. term.setBackgroundColor(colors.lightBlue)
  778. print("something went wrong with booting your PC")
  779. print("recovery is going to try and fix this error now")
  780. print("if this does not work then recovery will")
  781. print("reinstall LUAOS for you, if this doesnt work")
  782. print("then report this to the owner of the OS")
  783. print("thank you for using LUAOS")
  784. sleep(20)
  785. fs.makeDir("/LUAOS")
  786. fs.makeDir("/LUAOS/C")
  787. fs.makeDir("/LUAOS/S")
  788. fs.makeDir("/LUAOS/S/Users")
  789. if not fs.exists("/LUAOS") then
  790. print("LUAOS Recovery has failed to fix your computer")
  791. print("please report this code to the owner")
  792. print("LUAOSRFSNE(/LUAOS)")
  793. sleep(10)
  794. print("this computer will now shutdown")
  795. sleep(3)
  796. os.shutdown()
  797. end
  798. if not fs.exist("/LUAOS/C") then
  799. print("LUAOS Recovery has failed to fix your computer")
  800. print("please report this code to the owner")
  801. print("LUAOSRFSNE(/LUAOS/C)")
  802. sleep(10)
  803. print("this computer will now shutdown")
  804. sleep(3)
  805. os.shutdown()
  806. end
  807. if not fs.exists("/LUAOS/S") then
  808. print("LUAOS Recovery has failed to fix your computer")
  809. print("please report this code to the owner")
  810. print("LUAOSRFSNE(/LUAOS/S")
  811. sleep(10)
  812. print("this computer will now shutdown")
  813. sleep(3)
  814. os.shutdown()
  815. end
  816. if not fs.exists("/LUAOS/S/Users") then
  817. print("LUAOS Recovery has failed to fix your computer")
  818. print("please report this code to the owner")
  819. print("LUAOSRFSNE(/LUAOS/S/Users)")
  820. sleep(10)
  821. print("this computer will now shutdown")
  822. sleep(3)
  823. os.shutdown()
  824. end
  825. if not fs.exists("/enc") then
  826. print("LUAOS Recovery has failed to fix your computer")
  827. print("please report this code to the owner")
  828. print("LUAOSRFSNE(/enc)")
  829. sleep(10)
  830. print("this computer will now shutdown")
  831. sleep(3)
  832. os.shutdown()
  833. end
  834. print("LUAOS Recovery has fixed your computer, this computer will now restart")
  835. sleep(5)
  836. os.reboot()
  837. end
  838. function fc()
  839. if not fs.exists("/LUAOS") then
  840. print("/LUAOS does not exist, if you get this error please \n reinstall LUAOS or if that doesnt work \n then contact the owner, recovery will start now")
  841. sleep(10)
  842. recovery()
  843. end
  844. if not fs.exists("/LUAOS/C") then
  845. print("/LUAOS/C does not exist, if you get this error please \n reinstall LUAOS or if that doesnt work \n then contact the owner, recovery will start now")
  846. sleep(10)
  847. recovery()
  848. end
  849. if not fs.exists("/LUAOS/S") then
  850. print("/LUAOS/S does not exist, if you get this error please \n reinstall LUAOS or if that doesnt work \n then contact the owner, recovery will start now")
  851. sleep(10)
  852. recovery()
  853. end
  854. if not fs.exists("/LUAOS/S/Users") then
  855. print("/LUAOS/S/Users does not exist, if you get this error please \n reinstall LUAOS or if that doesnt work \n then contact the owner, recovery will start now")
  856. sleep(10)
  857. recovery()
  858. end
  859. if not fs.exists("/enc") then
  860. print("/LUAOS/S/Users does not exist, if you get this error please \n reinstall LUAOS or if that doesnt work \n then contact the owner, recovery will start now")
  861. sleep(10)
  862. recovery()
  863. end
  864. print("all essential files succesfully found")
  865. sleep(5)
  866. boot()
  867. end
  868. term.clear()
  869. term.setCursorPos(1,1)
  870. term.setTextColor(colors.red)
  871. build = "0.4.5 Indev"
  872. print("Welcome To LUAOS Version:",build)
  873. sleep(3)
  874. print("preparing to check files")
  875. textutils.slowPrint("|||||||||||||||||||||||||||||||||||||||||||||||||||")
  876. sleep(1)
  877. print("checking files now")
  878. if fs.exists("/LUAOSinstall") then
  879. fs.delete("/LUAOSinstall")
  880. end
  881. os.loadAPI("/enc")
  882. fc()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement