@@ -84,8 +84,11 @@ const uploadToPastebin = () => {
84
84
a . click ( ) ;
85
85
}
86
86
} ;
87
-
88
- xhr . send ( `api_dev_key=nSfNmQEF3ttNwx-zjU5MvguXnz8Oruw7&api_user_key=${ secret [ 'api_user_key' ] } &api_folder_key=5BbL8uf5&api_option=paste&api_paste_code=${ encodeURIComponent ( code ) } &api_paste_private=1&api_paste_name=${ ( fileName . value || 'workspace' ) + ' | lua (' + Math . random ( ) . toString ( 36 ) . substring ( 7 ) + ')' } &api_paste_format=lua` ) ;
87
+ if ( secret [ 'connected' ] === false ) {
88
+ xhr . send ( `api_dev_key=nSfNmQEF3ttNwx-zjU5MvguXnz8Oruw7&api_user_key=${ secret [ 'api_user_key' ] } &api_folder_key=5BbL8uf5&api_option=paste&api_paste_code=${ encodeURIComponent ( code ) } &api_paste_private=1&api_paste_name=${ ( fileName . value || 'workspace' ) + ' | lua (' + Math . random ( ) . toString ( 36 ) . substring ( 7 ) + ')' } &api_paste_format=lua` ) ;
89
+ } else {
90
+ xhr . send ( `api_dev_key=nSfNmQEF3ttNwx-zjU5MvguXnz8Oruw7&api_option=paste&api_paste_code=${ encodeURIComponent ( code ) } &api_paste_private=1&api_paste_name=${ ( fileName . value || 'workspace' ) + ' | lua (' + Math . random ( ) . toString ( 36 ) . substring ( 7 ) + ')' } &api_paste_format=lua` ) ;
91
+ }
89
92
}
90
93
91
94
const uploadWorkspaceToPastebin = ( ) => {
@@ -102,7 +105,11 @@ const uploadWorkspaceToPastebin = () => {
102
105
a . click ( ) ;
103
106
}
104
107
} ;
105
- xhr . send ( `api_dev_key=nSfNmQEF3ttNwx-zjU5MvguXnz8Oruw7&api_user_key=d43a286490fa94b7d413dd2f5eb8d38d&api_folder_key=5BbL8uf5&api_option=paste&api_paste_code=${ encodeURIComponent ( workspace ) } &api_paste_private=1&api_paste_name=${ ( fileName . value || 'workspace' ) + ' | workspace (' + Math . random ( ) . toString ( 36 ) . substring ( 7 ) + ')' } &api_paste_format=json` ) ;
108
+ if ( secret [ 'connected' ] === false ) {
109
+ xhr . send ( `api_dev_key=nSfNmQEF3ttNwx-zjU5MvguXnz8Oruw7&api_user_key=${ secret [ 'api_user_key' ] } &api_folder_key=5BbL8uf5&api_option=paste&api_paste_code=${ encodeURIComponent ( workspace ) } &api_paste_private=1&api_paste_name=${ ( fileName . value || 'workspace' ) + ' | workspace (' + Math . random ( ) . toString ( 36 ) . substring ( 7 ) + ')' } &api_paste_format=json` ) ;
110
+ } else {
111
+ xhr . send ( `api_dev_key=nSfNmQEF3ttNwx-zjU5MvguXnz8Oruw7&api_option=paste&api_paste_code=${ encodeURIComponent ( workspace ) } &api_paste_private=1&api_paste_name=${ ( fileName . value || 'workspace' ) + ' | workspace (' + Math . random ( ) . toString ( 36 ) . substring ( 7 ) + ')' } &api_paste_format=json` ) ;
112
+ }
106
113
}
107
114
108
115
const loadWorkspaceFromPastebin = ( ) => {
@@ -119,8 +126,32 @@ const loadWorkspaceFromPastebin = () => {
119
126
xhr . send ( ) ;
120
127
}
121
128
129
+ //const connectToPastebin = () => {
130
+ // const username = prompt('Enter pastebin username');
131
+ // const password = prompt('Enter pastebin password');
132
+ // const xhr = new XMLHttpRequest();
133
+ // xhr.open('POST', 'https://pastebin.com/api/api_login.php', true);
134
+ // xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
135
+ // xhr.onreadystatechange = () => {
136
+ // if (xhr.readyState == 4 && xhr.status == 200) {
137
+ // const response = xhr.responseText;
138
+ // if (response.startsWith('Bad API request')) {
139
+ // alert('Invalid username or password');
140
+ // } else {
141
+ // secret['api_user_key'] = response;
142
+ // alert('Connected to pastebin');
143
+ // connectButton.disabled = true;
144
+ // connectButton.innerText = 'Connected';
145
+ // }
146
+ // }
147
+ // };
148
+ // xhr.send(`api_dev_key=nSfNmQEF3ttNwx-zjU5MvguXnz8Oruw7&api_user_name=${username}&api_user_password=${password}`);
149
+ //}
150
+
151
+
122
152
downloadButton . onclick = downloadWorkspace ;
123
- uploadButton . onclick = uploadToPastebin ;
124
- uploadWorkspaceButton . onclick = uploadWorkspaceToPastebin ;
125
- loadWorkspaceButton . onclick = loadWorkspaceFromPastebin ;
126
- loadButton . onclick = loadWorkspace ;
153
+ loadButton . onclick = loadWorkspace ;
154
+ //connectButton.onclick = connectToPastebin;
155
+ //uploadButton.onclick = uploadToPastebin;
156
+ //uploadWorkspaceButton.onclick = uploadWorkspaceToPastebin;
157
+ //loadWorkspaceButton.onclick = loadWorkspaceFromPastebin;
0 commit comments