Advertisement
joshgreatuk

LUAOS Startup 0.4.2 Indev

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