Advertisement
joshgreatuk

LUAOS startup 0.5 Indev

Aug 3rd, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.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. 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.5
  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.setTextColor(colors.white)
  548. f1 = fs.open("/LUAOS/S/Temp/eid","r")
  549. f2 = fs.open("/LUAOS/S/Temp/t","r")
  550. eid = f1.readAll()
  551. t = f2.readAll()
  552. f1.close()
  553. f2.close()
  554. eid = enc.decrypt(eid,"teid")
  555. t = enc.decrypt(t,"tt")
  556. ma = "n"
  557. term.clear()
  558. if fs.exists("/LUAOS/S/Users/"..tonumber(eid).."/db.pic") then
  559. local db = paintutils.loadImage("/LUAOS/S/Users/"..tonumber(eid).."/db.pic")
  560. paintutils.drawImage(db,2,1)
  561. paintutils.drawLine(1,19,51,19,colors.blue)
  562. paintutils.drawLine(1,1,1,18,colors.blue)
  563. paintutils.drawLine(51,1,51,18,colors.blue)
  564. else
  565. local db = paintutils.loadImage("/LUAOS/S/ddb.pic")
  566. paintutils.drawImage(db,2,1)
  567. paintutils.drawLine(1,19,51,19,colors.blue)
  568. paintutils.drawLine(1,1,1,18,colors.blue)
  569. paintutils.drawLine(51,1,51,18,colors.blue)
  570. end
  571. while true do
  572. if ma == "y" then
  573. paintutils.drawFilledBox(1,1,10,18,colors.lightBlue)
  574. term.setBackgroundColor(colors.blue)
  575. term.setCursorPos(1,1)
  576. print("LUAOS Menu")
  577. term.setBackgroundColor(colors.lightBlue)
  578. end
  579. local x1,y1 = 1,19 --menu
  580. local x2,y2 = 10,0
  581. local x3,y3 = 52,19
  582. local x4,y4 = 1,17 --reboot
  583. local x5,y5 = 1,18 --shutdown
  584. local x6,y6 = 1,2 --browse files
  585. local x7,y7 = 1,3 --accounts
  586. local x8,y8 = 1,4 --settings
  587. local x9,y9 = 1,5 --programs
  588. local x10,y10 = 1,6 --update
  589. local x11,y11 = 1,7 --Apps/Games
  590. local x12,y12 = 1,16 --sign out
  591. local choice1 = "Menu"
  592. local choice2 = "Reboot"
  593. local choice3 = "Shutdown"
  594. local choice4 = "Files"
  595. local choice5 = "Accounts"
  596. local choice6 = "Settings"
  597. local choice7 = "Programs"
  598. local choice8 = "Update"
  599. local choice9 = "Apps/Games"
  600. local choice10 = "Sign Out"
  601. term.setBackgroundColor(colors.blue)
  602. term.setCursorPos(x1,y1)
  603. write(choice1)
  604. if ma == "y" then
  605. term.setBackgroundColor(colors.lightBlue)
  606. term.setCursorPos(x4,y4)
  607. write(choice2)
  608. term.setCursorPos(x5,y5)
  609. write(choice3)
  610. term.setCursorPos(x6,y6)
  611. write(choice4)
  612. term.setCursorPos(x7,y7)
  613. write(choice5)
  614. term.setCursorPos(x8,y8)
  615. write(choice6)
  616. term.setCursorPos(x9,y9)
  617. write(choice7)
  618. term.setCursorPos(x10,y10)
  619. write(choice8)
  620. term.setCursorPos(x11,y11)
  621. write(choice9)
  622. term.setCursorPos(x12,y12)
  623. write(choice10)
  624. end
  625. event, button, cx, cy = os.pullEvent()
  626. if event == "mouse_click" then
  627. if cx > x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 and ma == "n" then
  628. ma = "y"
  629. end
  630. if cx > x2 and cx < x3 and cy > y2 and cy < y3 and button == 1 and ma == "y" then
  631. ma = "n"
  632. li(eid,t)
  633. end
  634. if cx > x4 and cx < x4 + choice2:len() and cy == y4 and button == 1 and ma == "y" then
  635. os.reboot()
  636. fs.delete("/LUAOS/S/Temp/eid")
  637. fs.delete("/LUAOS/S/Temp/t")
  638. break
  639. else if cx > x5 and cx < x5 + choice3:len() and cy == y5 and button == 1 and ma == "y" then
  640. os.shutdown()
  641. fs.delete("/LUAOS/S/Temp/eid")
  642. fs.delete("/LUAOS/S/Temp/t")
  643. break
  644. else if cx > x6 and cx < x6 + choice4:len() and cy == y6 and button == 1 and ma == "y" then
  645. term.clear()
  646. dir = "/LUAOS/C"
  647. term.setCursorPos(1,1)
  648. fb(dir,eid,t)
  649. break
  650. else if cx > x7 and cx < x7 + choice5:len() and cy == y7 and button == 1 and ma == "y" then
  651. ac(eid,t)
  652. break
  653. else if cx > x8 and cx < x8 + choice6:len() and cy == y8 and button == 1 and ma == "y" then
  654. --add settings
  655. else if cx > x9 and cx < x9 + choice7:len() and cy == y9 and button == 1 and ma == "y" then
  656. pl(eid,t)
  657. break
  658. else if cx > x10 and cx < x10 + choice8:len() and cy == y10 and button == 1 and ma == "y" then
  659. ud(eid,t)
  660. break
  661. else if cx > x11 and cx < x11 + choice9:len() and cy == y11 and button == 1 and ma == "y" then
  662. ag(eid,t)
  663. break
  664. else if cx > x12 and cx < x12 + choice10:len() and cy == y12 and button == 1 and ma == "y" then
  665. boot()
  666. break
  667. end
  668. end
  669. end
  670. end
  671. end
  672. end
  673. end
  674. end
  675. end
  676. end
  677. end
  678. end
  679. function uc1()
  680. term.clear()
  681. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  682. paintutils.drawBox(1,1,51,19,colors.blue)
  683. term.setBackgroundColor(colors.lightBlue)
  684. term.setTextColor(colors.white)
  685. term.setCursorPos(3,3)
  686. print("welcome to the LUAOS first user setup")
  687. term.setCursorPos(3,4)
  688. print("your first user will be an administrator")
  689. term.setCursorPos(3,5)
  690. print("administrators can edit and add users")
  691. term.setCursorPos(3,6)
  692. print("while normal users cant, administrators")
  693. term.setCursorPos(3,7)
  694. print("can also install apps onto the PC but")
  695. term.setCursorPos(3,8)
  696. print("normal users also can if they have their")
  697. term.setCursorPos(3,9)
  698. print("administrators password.The ID of this")
  699. term.setCursorPos(3,10)
  700. print("account will be '1'")
  701. term.setCursorPos(3,11)
  702. print("press enter to create your account.")
  703. back = read()
  704. term.clear()
  705. term.setCursorPos(3,3)
  706. print("Now to make your administrator account")
  707. term.setCursorPos(3,5)
  708. print("Username:")
  709. term.setCursorPos(3,6)
  710. print("Password:")
  711. term.setCursorPos(12,5)
  712. nu = read()
  713. term.setCursorPos(12,6)
  714. np = read("*")
  715. nu = enc.encrypt(nu,"1user")
  716. np = enc.encrypt(np,"1pass")
  717. t = enc.encrypt(t,"1perm")
  718. fs.makeDir("/LUAOS/S/Users/1")
  719. f = fs.open("/LUAOS/S/Users/1/u", "w")
  720. f.write(nu)
  721. f.close()
  722. f = fs.open("/LUAOS/S/Users/1/p", "w")
  723. f.write(np)
  724. f.close()
  725. f = fs.open("/LUAOS/S/Users/1/t", "w")
  726. f.write(t)
  727. f.close()
  728. term.setCursorPos(3,8)
  729. print("Your new account has been made!")
  730. term.setCursorPos(3,9)
  731. print("Restarting now!")
  732. sleep(5)
  733. os.reboot()
  734. end
  735. function boot()
  736. term.clear()
  737. if not fs.exists("LUAOS/S/Users/1") then
  738. uc1()
  739. end
  740. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  741. paintutils.drawBox(1,1,51,19,colors.blue)
  742. term.setTextColor(colors.white)
  743. term.setBackgroundColor(colors.lightBlue)
  744. term.setCursorPos(3,3)
  745. print("Welcome to LUAOS login")
  746. term.setCursorPos(3,6)
  747. print("Enter your ID to contine")
  748. term.setCursorPos(3,9)
  749. eid = read()
  750. if not fs.exists("LUAOS/S/Users/"..eid) then
  751. term.clear()
  752. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  753. paintutils.drawBox(1,1,51,19,colors.blue)
  754. term.setBackgroundColor(colors.lightBlue)
  755. term.setCursorPos(3,3)
  756. print("Your ID is invalid, it may not exist")
  757. sleep(5)
  758. term.setCursorPos(3,5)
  759. print("Do you want to shutdown?, Y/N")
  760. local sEvent, param = os.pullEvent("key")
  761. if param == 21 then
  762. os.shutdown()
  763. else
  764. boot()
  765. end
  766. else if eid == "" then
  767. term.clear()
  768. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  769. paintutils.drawBox(1,1,51,19,colors.blue)
  770. term.setBackgroundColor(colors.lightBlue)
  771. term.setCursorPos(3,3)
  772. print("Your ID is invalid, it may not exist")
  773. sleep(5)
  774. term.setCursorPos(3,5)
  775. print("Do you want to shutdown?, Y/N")
  776. local sEvent, param = os.pullEvent("key")
  777. if param == 21 then
  778. os.shutdown()
  779. else
  780. boot()
  781. end
  782. end
  783. end
  784. term.clear()
  785. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  786. paintutils.drawBox(1,1,51,19,colors.blue)
  787. term.setBackgroundColor(colors.lightBlue)
  788. term.setCursorPos(3,3)
  789. print("Now login to your account")
  790. term.setCursorPos(3,6)
  791. print("Username:")
  792. term.setCursorPos(3,8)
  793. print("Password:")
  794. term.setCursorPos(12,6)
  795. eu = read()
  796. term.setCursorPos(12,8)
  797. ep = read("*")
  798. dir1 = "/LUAOS/S/Users/"..eid.."/u"
  799. dir2 = "/LUAOS/S/Users/"..eid.."/p"
  800. dir3 = "/LUAOS/S/Users/"..eid.."/t"
  801. fu = fs.open(dir1,"r")
  802. ru = fu.readAll()
  803. fu.close()
  804. fp = fs.open(dir2,"r")
  805. rp = fp.readAll()
  806. fp.close()
  807. ft = fs.open(dir3,"r")
  808. t = ft.readAll()
  809. ft.close()
  810. eu1 = eid.."user"
  811. ep1 = eid.."pass"
  812. et1 = eid.."perm"
  813. ru = enc.decrypt(ru,eu1)
  814. rp = enc.decrypt(rp,ep1)
  815. t = enc.decrypt(t,et1)
  816. if eu == ru and ep == rp then
  817. term.setCursorPos(3,11)
  818. print("Welcome to LUAOS",ru)
  819. eid = enc.encrypt(eid,"teid")
  820. t = enc.encrypt(t,"tt")
  821. sleep(5)
  822. f1 = fs.open("/LUAOS/S/Temp/eid","w")
  823. f2 = fs.open("/LUAOS/S/Temp/t","w")
  824. f1.write(eid)
  825. f2.write(t)
  826. f1.close()
  827. f2.close()
  828. li()
  829. else
  830. term.setCursorPos(3,11)
  831. print("Incorrect username and/or password")
  832. print("Do you want to shutdown?, Y/N")
  833. local sEvent, param = os.pullEvent("key")
  834. if param == 21 then
  835. os.shutdown()
  836. else
  837. boot()
  838. end
  839. end
  840. end
  841. function recovery()
  842. term.clear()
  843. paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
  844. paintutils.drawBox(1,1,51,19,colors.blue)
  845. term.setBackgroundColor(colors.lightBlue)
  846. print("something went wrong with booting your PC")
  847. print("recovery is going to try and fix this error now")
  848. print("if this does not work then recovery will")
  849. print("reinstall LUAOS for you, if this doesnt work")
  850. print("then report this to the owner of the OS")
  851. print("thank you for using LUAOS")
  852. sleep(20)
  853. fs.makeDir("/LUAOS")
  854. fs.makeDir("/LUAOS/C")
  855. fs.makeDir("/LUAOS/S")
  856. fs.makeDir("/LUAOS/S/Users")
  857. if not fs.exists("/LUAOS") then
  858. print("LUAOS Recovery has failed to fix your computer")
  859. print("please report this code to the owner")
  860. print("LUAOSRFSNE(/LUAOS)")
  861. sleep(10)
  862. print("this computer will now shutdown")
  863. sleep(3)
  864. os.shutdown()
  865. end
  866. if not fs.exist("/LUAOS/C") then
  867. print("LUAOS Recovery has failed to fix your computer")
  868. print("please report this code to the owner")
  869. print("LUAOSRFSNE(/LUAOS/C)")
  870. sleep(10)
  871. print("this computer will now shutdown")
  872. sleep(3)
  873. os.shutdown()
  874. end
  875. if not fs.exists("/LUAOS/S") then
  876. print("LUAOS Recovery has failed to fix your computer")
  877. print("please report this code to the owner")
  878. print("LUAOSRFSNE(/LUAOS/S")
  879. sleep(10)
  880. print("this computer will now shutdown")
  881. sleep(3)
  882. os.shutdown()
  883. end
  884. if not fs.exists("/LUAOS/S/Users") then
  885. print("LUAOS Recovery has failed to fix your computer")
  886. print("please report this code to the owner")
  887. print("LUAOSRFSNE(/LUAOS/S/Users)")
  888. sleep(10)
  889. print("this computer will now shutdown")
  890. sleep(3)
  891. os.shutdown()
  892. end
  893. if not fs.exists("/enc") then
  894. print("LUAOS Recovery has failed to fix your computer")
  895. print("please report this code to the owner")
  896. print("LUAOSRFSNE(/enc)")
  897. sleep(10)
  898. print("this computer will now shutdown")
  899. sleep(3)
  900. os.shutdown()
  901. end
  902. print("LUAOS Recovery has fixed your computer, this computer will now restart")
  903. sleep(5)
  904. os.reboot()
  905. end
  906. function fc()
  907. if not fs.exists("/LUAOS") then
  908. 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")
  909. sleep(10)
  910. recovery()
  911. end
  912. if not fs.exists("/LUAOS/C") then
  913. 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")
  914. sleep(10)
  915. recovery()
  916. end
  917. if not fs.exists("/LUAOS/S") then
  918. 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")
  919. sleep(10)
  920. recovery()
  921. end
  922. if not fs.exists("/LUAOS/S/Users") then
  923. 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")
  924. sleep(10)
  925. recovery()
  926. end
  927. if not fs.exists("/enc") then
  928. 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")
  929. sleep(10)
  930. recovery()
  931. end
  932. print("all essential files succesfully found")
  933. sleep(5)
  934. boot()
  935. end
  936. term.clear()
  937. term.setCursorPos(1,1)
  938. term.setTextColor(colors.red)
  939. build = "0.5 Indev"
  940. print("Welcome To LUAOS Version:",build)
  941. sleep(3)
  942. print("preparing to check files")
  943. textutils.slowPrint("|||||||||||||||||||||||||||||||||||||||||||||||||||")
  944. sleep(1)
  945. print("checking files now")
  946. if fs.exists("/LUAOSinstall") then
  947. fs.delete("/LUAOSinstall")
  948. end
  949. os.loadAPI("/enc")
  950. fc()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement