Advertisement
joshgreatuk

LUAOS Startup 0.4.4 Indev

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