Improve pad sharing
This commit is contained in:
parent
49c7c1cf61
commit
372c8d9c24
@ -138,7 +138,7 @@ public class FileUtils {
|
|||||||
|
|
||||||
public static String getUrl(String url) throws MalformedURLException, IOException {
|
public static String getUrl(String url) throws MalformedURLException, IOException {
|
||||||
String out;
|
String out;
|
||||||
try (Scanner sc = new Scanner(new URL("http://www.google.com").openStream(), "UTF-8")) {
|
try (Scanner sc = new Scanner(new URL(url).openStream(), "UTF-8")) {
|
||||||
out = sc.useDelimiter("\\A").next();
|
out = sc.useDelimiter("\\A").next();
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
|
@ -210,11 +210,13 @@ public class SharePad extends javax.swing.JPanel {
|
|||||||
String f = FileUtils.getUrl(
|
String f = FileUtils.getUrl(
|
||||||
Main.API_URL + "sendpad.php?email="
|
Main.API_URL + "sendpad.php?email="
|
||||||
+ email + "&padid=" + pad);
|
+ email + "&padid=" + pad);
|
||||||
|
Debug.println(f);
|
||||||
if (f.contains("OK")) {
|
if (f.contains("OK")) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
emailBtn.setText("Link Sent!");
|
emailBtn.setText("Link Sent!");
|
||||||
|
emailBox.setText("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -226,6 +228,7 @@ public class SharePad extends javax.swing.JPanel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
Debug.stacktrace(ex);
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -241,7 +244,7 @@ public class SharePad extends javax.swing.JPanel {
|
|||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
emailBtn.setEnabled(true);
|
emailBtn.setEnabled(License.checkEmail(emailBox.getText()));
|
||||||
emailBtn.setText("Send Email");
|
emailBtn.setText("Send Email");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user