From: David ‘Bombe’ Roden Date: Sat, 29 Sep 2007 21:30:29 +0000 (+0000) Subject: add button to generate a new key pair for a project X-Git-Tag: 0.4.9 X-Git-Url: https://git.pterodactylus.net/?p=jSite.git;a=commitdiff_plain;h=bfa8ea22740bd472403c67eb383e3fd25b8f93c8 add button to generate a new key pair for a project --- diff --git a/src/de/todesbaum/jsite/gui/ProjectPage.java b/src/de/todesbaum/jsite/gui/ProjectPage.java index 8afd696..086493c 100644 --- a/src/de/todesbaum/jsite/gui/ProjectPage.java +++ b/src/de/todesbaum/jsite/gui/ProjectPage.java @@ -76,6 +76,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D private Action projectDeleteAction; private Action projectCloneAction; private Action projectCopyURIAction; + private Action projectGenerateKeyAction; private JFileChooser pathChooser; private SortedListModel projectListModel; @@ -179,6 +180,15 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D projectCopyURIAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.copy-uri.tooltip")); projectCopyURIAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_U); projectCopyURIAction.setEnabled(false); + + projectGenerateKeyAction = new AbstractAction(I18n.getMessage("jsite.project.action.generate-new-key")) { + public void actionPerformed(ActionEvent actionEvent) { + actionGenerateNewKey(); + } + }; + projectGenerateKeyAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.generate-new-key.tooltip")); + projectGenerateKeyAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_G); + projectGenerateKeyAction.setEnabled(false); } private JComponent createInformationPanel() { @@ -231,7 +241,8 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D projectPublicKeyTextField.setEnabled(false); informationTable.add(new TLabel(I18n.getMessage("jsite.project.project.public-key") + ":", KeyEvent.VK_U, projectPublicKeyTextField), new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0)); - informationTable.add(projectPublicKeyTextField, new GridBagConstraints(1, 5, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0)); + informationTable.add(projectPublicKeyTextField, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0)); + informationTable.add(new JButton(projectGenerateKeyAction), new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0)); projectPrivateKeyTextField = new JTextField(27); projectPrivateKeyTextField.getDocument().putProperty("name", "project.privatekey"); @@ -369,6 +380,27 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D clipboard.setContents(new StringSelection(selectedProject.getFinalRequestURI(0)), this); } } + + protected void actionGenerateNewKey() { + if (JOptionPane.showConfirmDialog(this, I18n.getMessage("jsite.project.warning.generate-new-key"), null, JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) { + return; + } + int selectedIndex = projectList.getSelectedIndex(); + if (selectedIndex > -1) { + Project selectedProject = (Project) projectList.getSelectedValue(); + String[] keyPair = null; + try { + keyPair = freenetInterface.generateKeyPair(); + } catch (IOException ioe1) { + JOptionPane.showMessageDialog(this, MessageFormat.format(I18n.getMessage("jsite.project.keygen.io-error"), ioe1.getMessage()), null, JOptionPane.ERROR_MESSAGE); + return; + } + selectedProject.setInsertURI(keyPair[0]); + selectedProject.setRequestURI(keyPair[1]); + projectPublicKeyTextField.setText(selectedProject.getRequestURI()); + projectPrivateKeyTextField.setText(selectedProject.getInsertURI()); + } + } // // INTERFACE ListSelectionListener @@ -390,6 +422,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D projectDeleteAction.setEnabled(selectedRow > -1); projectCloneAction.setEnabled(selectedRow > -1); projectCopyURIAction.setEnabled(selectedRow > -1); + projectGenerateKeyAction.setEnabled(selectedRow > -1); if (selectedRow > -1) { projectNameTextField.setText(selectedProject.getName()); projectDescriptionTextField.setText(selectedProject.getDescription()); diff --git a/src/de/todesbaum/jsite/i18n/jSite.properties b/src/de/todesbaum/jsite/i18n/jSite.properties index 8bf151c..08ecf4e 100644 --- a/src/de/todesbaum/jsite/i18n/jSite.properties +++ b/src/de/todesbaum/jsite/i18n/jSite.properties @@ -79,6 +79,8 @@ jsite.project.action.clone-project.copy=Copy of {0} jsite.project.action.clone-project.tooltip=Clone the selected project jsite.project.action.copy-uri=Copy URI to Clipboard jsite.project.action.copy-uri.tooltip=Copies the URI of the project to the clipboard +jsite.project.action.generate-new-key=Generate New Key +jsite.project.action.generate-new-key.tooltip=Generates a new key for the project jsite.project.project.information=Project Information jsite.project.project.name=Name jsite.project.project.description=Description @@ -91,6 +93,7 @@ jsite.project.project.edition=Edition jsite.project.keygen.io-error=Node communication failure

Communication with the node failed
with the following error message:

{0}

Please make sure that you have entered
the correct host name and port number
on the "Node Settings" page. jsite.project.warning.no-local-path=No local path

You did not specify a local path for the files to insert.
It is not possible to continue without one. jsite.project.warning.no-path=No freesite path

You did not specify a freesite path.
It is not possible to continue without one. +jsite.project.warning.generate-new-key=Generate new key?

If you generate a new key, your site will be published
under that new key. Any trust that other users put
in the old key of your site will be gone! jsite.project-files.heading=Project Files jsite.project-files.description=On this page you can specify parameters for the files within the project, such as
externally generated keys or MIME types, if the automatic detection failed. diff --git a/src/de/todesbaum/jsite/i18n/jSite_de.properties b/src/de/todesbaum/jsite/i18n/jSite_de.properties index 12607f8..b13dd28 100644 --- a/src/de/todesbaum/jsite/i18n/jSite_de.properties +++ b/src/de/todesbaum/jsite/i18n/jSite_de.properties @@ -79,6 +79,8 @@ jsite.project.action.clone-project.copy=Kopie von {0} jsite.project.action.clone-project.tooltip=Das ausgewählte Projekt duplizieren jsite.project.action.copy-uri=URI kopieren jsite.project.action.copy-uri.tooltip=Kopiert die URI des ausgewählten Projektes in die Zwischenablage +jsite.project.action.generate-new-key=Schlüssel generieren +jsite.project.action.generate-new-key.tooltip=Generiert ein neues Schlüsselpaar für das Projekt jsite.project.project.information=Projektinformation jsite.project.project.name=Name jsite.project.project.description=Beschreibung @@ -91,6 +93,7 @@ jsite.project.project.edition=Edition jsite.project.keygen.io-error=Kommunikation fehlgeschlagen

Die Kommunikation mit dem Freenet Node
ergab folgende Fehlermeldung:

{0}

Bitte vergewissern Sie sich, dass der Node läuft und dass Sie
den korrekten Hostnamen und die korrekte Portnummer auf der
\u201eNode Einstellungen\u201c Seite eingegeben haben. jsite.project.warning.no-local-path=Kein lokaler Pfad

Sie haben keinen lokalen Pfad für die einzufügenden Dateien angegeben.
Es ist nicht möglich, ohne lokalen Pfad weiter zu machen. jsite.project.warning.no-path=Kein Freesite-Pfad

Sie haben keinen Pfad für die Freesite angegeben.
Es ist nicht möglich, ohne einen Freesite-Pfad weiter zu machen. +jsite.project.warning.generate-new-key=Neues Schlüsselpaar generieren?

Wenn Sie das Schlüsselpaar für das Projekt ändern,
wird sich die URI für Ihr Projekt ebenfalls
ändern, und jegliches Vertrauen, dass andere
Benutzer in das alte Schlüsselpaar hatten, wird
verloren gehen! jsite.project-files.heading=Projektdateien jsite.project-files.description=Auf dieser Seite können Parameter für die einzelnen Dateien dieses Projekts angegeben werden, z.B.
extern erstellte Schlüssel oder der korrekte MIME-Typ, wenn er nicht automatisch richtig erkannt wurde. diff --git a/src/de/todesbaum/jsite/i18n/jSite_fr.properties b/src/de/todesbaum/jsite/i18n/jSite_fr.properties index 51357b6..a37423d 100644 --- a/src/de/todesbaum/jsite/i18n/jSite_fr.properties +++ b/src/de/todesbaum/jsite/i18n/jSite_fr.properties @@ -77,6 +77,8 @@ jsite.project.action.delete-project.confirm=Confirmez la suppressionErreur de communication avec le noeud

La communication avec le noeud à échouée
Erreur:

{0}

Assurez vous que les informations saisies dans la page de configuration sont correctes. jsite.project.warning.no-local-path=Pas de chemin local spécifié

Vous avez omis de spécifier le chemin local à insérer. jsite.project.warning.no-path=Vous n'avez pas spécifié de chemin dans le freesite

Vous n'avez pas spécifié de chemin dans le freesite.
Ce champ est nécessaire. +jsite.project.warning.generate-new-key= jsite.project-files.heading=Fichiers du projet jsite.project-files.description=Dans cette page vous pouvez spécifier les informations concernant la configuration des noeuds telles que:
Le type de contenu mime si l'auto détection à échouée. diff --git a/src/de/todesbaum/jsite/main/Version.java b/src/de/todesbaum/jsite/main/Version.java index 44c724a..f303c96 100644 --- a/src/de/todesbaum/jsite/main/Version.java +++ b/src/de/todesbaum/jsite/main/Version.java @@ -25,7 +25,7 @@ package de.todesbaum.jsite.main; */ public class Version { - private static final String VERSION = "0.4.8.2-pre-1"; + private static final String VERSION = "0.4.9"; public static final String getVersion() { return VERSION;