Advertisement
Guest User

Untitled

a guest
Jun 9th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.90 KB | None | 0 0
  1. //startup/startup.js
  2. // This code is under embargo until 6/9/2025.
  3. // (c) speedyplane2247 2017-2018
  4. // Any unauthorized use of this code is illegal, as described by the NDA used to ensure this code.
  5. var isFirstRun = Object()
  6.  
  7. this.isFirstRun = $store.getRaw('/f.dat')
  8.  
  9. if (this.isFirstRun == null) {
  10.  
  11. setupUser()
  12.  
  13. } else
  14.  
  15. {
  16.  
  17. readUserFile()
  18.  
  19. }
  20.  
  21. /*
  22.  
  23. Example User File
  24.  
  25. ---
  26.  
  27. userfileheader;07;example;p;05;12345;ender;;08;example1;p;06;123456;;
  28.  
  29. */
  30.  
  31. var doRun = new Object()
  32.  
  33. var userObject = new Object()
  34.  
  35. var userTable = new Object()
  36.  
  37. this.userTable = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]
  38.  
  39. this.userObject = $store.getRaw('/users.js')
  40.  
  41. for (xc = 0; xc++; xc < 27) {
  42.  
  43.  
  44.  
  45. }
  46.  
  47. //createuser
  48.  
  49. function setupUser() {
  50.  
  51.  
  52.  
  53. if (this.userTable == null) {
  54.  
  55. var userTable = new Object()
  56.  
  57. this.userTable = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]
  58.  
  59. }
  60.  
  61. if (this.currentFile == null) {
  62.  
  63. var currentFile = new Object()
  64.  
  65. } else
  66.  
  67. {
  68.  
  69. this.currentFile = ""
  70.  
  71. }
  72.  
  73. $alert.info("Remember: Did you load your files.json? If you didn't that's fine, you just won't be able to access the custom themes.")
  74.  
  75. $prompt('Please type the name of the first user:', 'example', function(ok, text) {
  76.  
  77. if (ok) {
  78.  
  79. var textLength = new Object()
  80.  
  81. this.textLength = text.toString().length
  82.  
  83. if (this.textLength > 99) {
  84.  
  85. $alert.info("Your username can't be over 99 charactors long.")
  86.  
  87. setupUser();
  88.  
  89. }
  90.  
  91. for (i = 0; i++; i < this.textLength + 1) {
  92.  
  93. if (text.toString().charAt(i) == ";") {
  94.  
  95. $alert.info("Invalid character! Please only use alphanumeric characters.")
  96.  
  97. setupUser();
  98.  
  99. } else {
  100.  
  101. this.currentFile = "userfileheader;" + this.textLength + ";" + text + ";p;"
  102.  
  103. }
  104.  
  105. }
  106.  
  107. } else {
  108.  
  109. $alert.info("You will be prompted on the next reboot to setup.")
  110.  
  111. }
  112.  
  113. });
  114.  
  115. $prompt('Please type the password', '12345', function(ok, text) {
  116.  
  117. if (ok) {
  118.  
  119. var textLengthX = new Object()
  120.  
  121. this.textLengthX = text.toString().length
  122.  
  123. if (this.textLength > 99) {
  124.  
  125. $alert.info("Your username can't be over 99 charactors long.")
  126.  
  127. setupUser();
  128.  
  129. }
  130.  
  131. for (i = 0; i++; i < this.textLengthX + 1) {
  132.  
  133. if (text.toString().charAt(i) == ";") {
  134.  
  135. $alert.info("Invalid character! Please only use alphanumeric characters.")
  136.  
  137. setupUser();
  138.  
  139. } else {
  140.  
  141. this.currentFile = this.currentFile + textLengthX.toString() + ";" + text + ";ender"
  142.  
  143. $store.set("/f.dat", "success")
  144.  
  145. $store.set("/users.js", this.currentFile.toString())
  146.  
  147. }
  148.  
  149. }
  150.  
  151. }
  152.  
  153. });
  154.  
  155. }
  156.  
  157. //startup/login.js
  158.  
  159. function login() {
  160.  
  161. var loginObject = new Object()
  162.  
  163. this.loginObject = 0
  164.  
  165. var tempVar = new Object()
  166.  
  167. var scratchPad = new Object()
  168.  
  169. var allowPad = new Object()
  170.  
  171. tempVar = $store.getRaw("/users.js")
  172.  
  173. scratchPad = tempVar.toString().indexOf("userfileheader;")
  174.  
  175. if (scratchPad.toString() != "0") {
  176.  
  177. allowPad = allowPad + 1
  178.  
  179. } else
  180.  
  181. {
  182.  
  183. $alert.error("Currupted userfile! \n\nReseting...");
  184.  
  185. setupUser();
  186.  
  187. }
  188.  
  189. scratchPad = tempVar.toString().charAt(17)
  190.  
  191. var userLength = new Object()
  192.  
  193. var userLengthX = new Object()
  194.  
  195. userLength = scratchPad
  196.  
  197. scratchPad = tempVar.toString().charAt(18)
  198.  
  199. userLengthX = scratchPad
  200.  
  201. var userLengthX2 = new Object()
  202.  
  203. userLengthX2 = userLength + userLengthX
  204.  
  205. var userLengthX3 = new Object()
  206.  
  207. userLengthX3 = parseInt(userLengthX2)
  208.  
  209. var userLengthX4 = new Object()
  210.  
  211. userLengthX4 = userLengthX3 + 18
  212.  
  213. // 19
  214.  
  215. var username = new Object()
  216.  
  217. for (i = 18; i++; i < userLengthX4) {
  218.  
  219. username = username + tempVar.toString().charAt(i)
  220.  
  221. var currentChar = new Object()
  222.  
  223. currentChar = i
  224.  
  225. }
  226.  
  227. if (tempVar.toString().indexOf(";p;").toString() != currentChar) {
  228.  
  229. $alert.error("Currupted userfile! \n\nReseting...");
  230.  
  231. setupUser();
  232.  
  233. }
  234.  
  235. scratchPad = tempVar.toString().charAt(26)
  236.  
  237. var passLength = new Object()
  238.  
  239. var passLengthX = new Object()
  240.  
  241. passLength = scratchPad
  242.  
  243. scratchPad = tempVar.toString().charAt(27)
  244.  
  245. userLengthX = scratchPad
  246.  
  247. var passLengthX2 = new Object()
  248.  
  249. passLengthX2 = passLength + passLengthX
  250.  
  251. var passLengthX3 = new Object()
  252.  
  253. passLengthX3 = parseInt(passLengthX2)
  254.  
  255. var passLengthX4 = new Object()
  256.  
  257. passLengthX4 = passLengthX3 + 28
  258.  
  259. var passname = new Object()
  260.  
  261. for (i = 28; i++; i < userLengthX4) {
  262.  
  263. passname = passname + tempVar.toString().charAt(i)
  264.  
  265. var currentCharX = new Object()
  266.  
  267. currentCharX = i
  268.  
  269. }
  270.  
  271. if (tempVar.toString().indexOf(";ender;;").toString() != currentCharX) {
  272.  
  273. $alert.error("Currupted userfile! \n\nReseting...");
  274.  
  275. setupUser();
  276.  
  277. }
  278.  
  279. var xkk = new Object()
  280.  
  281. $prompt('Username: ', 'boi', function(ok, text) {
  282.  
  283. if (ok) {
  284.  
  285. if (username == text) {
  286.  
  287. this.xkk = "verifiedUsername"
  288.  
  289. }
  290.  
  291. } else {
  292.  
  293. tellUser();
  294.  
  295. }
  296.  
  297. });
  298.  
  299. var isSession = new Object()
  300.  
  301. $prompt('Password: ', 'boi', function(ok, text) {
  302.  
  303. if (ok) {
  304.  
  305. if (passname == text && this.xkk == "verifiedUsername") {
  306.  
  307. continueLogin(username)
  308.  
  309. }
  310.  
  311. } else {
  312.  
  313. tellUser();
  314.  
  315. }
  316.  
  317. });
  318.  
  319. $prompt('Do you want this to be a admin session? (y/n)', 'n', function(ok, text) {
  320.  
  321. if (ok) {
  322.  
  323. if (text.toLowerCase() == "y") {
  324.  
  325. this.isSession = "yes"
  326.  
  327. } else {
  328.  
  329. this.isSession = "no"
  330.  
  331. }
  332.  
  333. } else {
  334.  
  335. $alert.error("Since you didn't specify, it will be taken as a No.")
  336.  
  337. }
  338.  
  339. });
  340.  
  341. }
  342.  
  343. function continueLogin(username) {
  344.  
  345. var verfiedUsername = new Object()
  346.  
  347. var internalUser = new Object()
  348.  
  349. this.internalUser.user = username
  350.  
  351. if (this.isSession == "yes") {
  352.  
  353. this.internalUser.canKA = true
  354.  
  355. } else
  356.  
  357. {
  358.  
  359. this.internalUser.role = "standard"
  360.  
  361. }
  362.  
  363. verfiedUsername.username = username
  364.  
  365. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement