diff --git a/out/unzip/molokoin/molokoin-client/css/style.css b/out/unzip/molokoin/molokoin-client/css/style.css new file mode 100644 index 0000000..50893ee --- /dev/null +++ b/out/unzip/molokoin/molokoin-client/css/style.css @@ -0,0 +1,45 @@ +body { + font-family: Arial; + padding: 20px; + background: #f1f1f1; +} +div { + background-color: rgb(181, 122, 236); + padding: 5px; + margin: 5px; +} +.header{ + display: block; + padding: 30px; + font-size: 40px; + text-align: center; + background: rgb(181, 122, 236); + /*position: relative; top: 20px;*/ +} +.controls{ + /*position: relative; left: 20px;*/ + list-style: none; /* Отключение отображения маркеров. */ + width: 25%; /* Ширина меню. */ + float: left; + /*padding-left: 20px;*/ +} +.controls li { + margin: 5px; /* Отступ между блоками по высоте, необходимый для того чтобы пункты меню не сливались */ + font-family: Verdana, Arial, Helvetica, sans-serif; /* Тип шрифта пунктов меню */ + font-size: 14px; /* Размер текста меню */ +} +.controls li a{ + display: block; /* Изменение отображения на блочное для того, чтобы иметь возможность задать внутренние отступы. */ + padding: 4px 15px; /* Отступы внутри блоков. */ + background: #0db5b5; /* Цвет блоков меню. */ + color: #3f3f3f; /* Цвет текста в блоках меню. */ + text-decoration: none; /* Устранение подчёркивания ссылок. */ + position: relative; /* Это необходимо при использовании Internet Explorer 6 для того, чтобы ссылка по всей своей площади была «кликабельной». */ +} +.controls li a:hover { + background: #92d3d3; /* Цвет фона при наведении курсора мыши */ + color: #6b6b6b; /* Цвет текста при наведении курсора мыши */ +} +.mainframe{ + background-color: aliceblue; +} \ No newline at end of file diff --git a/out/unzip/molokoin/molokoin-client/index.html b/out/unzip/molokoin/molokoin-client/index.html new file mode 100644 index 0000000..744949d --- /dev/null +++ b/out/unzip/molokoin/molokoin-client/index.html @@ -0,0 +1,23 @@ + + + + + + + molokoin.ru + + + +
+ molokoin.ru/ добавить картинку и кнопку авторизации +
+
+
  • gitea
  • +
  • apache
  • +
  • moodle
  • +
  • adminvps
  • + +
    + + + \ No newline at end of file diff --git a/out/unzip/molokoin/molokoin-client/js/main.js b/out/unzip/molokoin/molokoin-client/js/main.js new file mode 100644 index 0000000..1a90dbd --- /dev/null +++ b/out/unzip/molokoin/molokoin-client/js/main.js @@ -0,0 +1 @@ +console.log("qu") \ No newline at end of file diff --git a/out/zip/molokoin-client-master.zip b/out/zip/molokoin-client-master.zip new file mode 100644 index 0000000..61ce159 Binary files /dev/null and b/out/zip/molokoin-client-master.zip differ diff --git a/src/main/java/ru/molokoin/sourceListener/SourceListener.java b/src/main/java/ru/molokoin/sourceListener/SourceListener.java deleted file mode 100644 index 5bf9c3e..0000000 --- a/src/main/java/ru/molokoin/sourceListener/SourceListener.java +++ /dev/null @@ -1,148 +0,0 @@ -package ru.molokoin.sourceListener; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.URI; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.util.Enumeration; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -import org.eclipse.jgit.api.Git; -import org.eclipse.jgit.api.errors.GitAPIException; -import org.eclipse.jgit.api.errors.InvalidRemoteException; -import org.eclipse.jgit.api.errors.TransportException; -import org.eclipse.jgit.lib.Repository; - -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.databind.DatabindException; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class SourceListener { - public Options opt; - public String optionsPath = "options-home.json"; - public SourceListener(){ - try { - opt = readOptions(); - } catch (StreamReadException e) { - System.out.println(e.getMessage()); - e.printStackTrace(); - } catch (DatabindException e) { - System.out.println(e.getMessage()); - e.printStackTrace(); - } catch (IOException e) { - System.out.println(e.getMessage()); - e.printStackTrace(); - } - } - /** - * Метод запускает бесконечный цикл проверки обновлений в репозитарии. - */ - public void live(){ - // - } - /** - * Метод проверяет, поступили ли обновления в репозитарий - * @return - */ - public boolean isUpdated(){ - try { - Repository repo = RepoCrafter.copy(opt.getGitLink(), new File(opt.getGitLocalPath())); - System.out.println(repo.getConfig()); - System.out.println(repo.getIndexFile()); - Git git = new Git(repo); - - - //repo.close(); - } catch (InvalidRemoteException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (TransportException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (GitAPIException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return true; - } - /** - * Извлечение данных из options.json - * @return - * @throws StreamReadException - * @throws DatabindException - * @throws IOException - */ - public Options readOptions() throws StreamReadException, DatabindException, IOException{ - Options opt; - ObjectMapper mapper = new ObjectMapper(); - opt = mapper.readValue(new File(optionsPath), Options.class); - return opt; - } - public Options getOpt() { - return opt; - } - /** - * распаковка архива - */ - public void extract()throws IOException{ - //считываем настройки извлечения - try (ZipFile file = new ZipFile(opt.getZipPath())){ - Enumeration zipEntries = file.entries(); - while (zipEntries.hasMoreElements()){ - ZipEntry zipEntry = zipEntries.nextElement(); - File newFile = new File(opt.getUnzipPath(), zipEntry.getName()); - newFile.getParentFile().mkdirs(); - if (!zipEntry.isDirectory()){ - try (FileOutputStream outputStream = new FileOutputStream(newFile)){ - BufferedInputStream inputStream = new BufferedInputStream(file.getInputStream(zipEntry)); - while (inputStream.available() > 0){ - outputStream.write(inputStream.read()); - } - inputStream.close(); - } - } - } - } - } - /** - * скачиваем архив проекта из системы контроля версий, - * или иной файл с другого ресурса ... - */ - public void download(){ - HttpClient client = HttpClient.newHttpClient(); - HttpRequest request = HttpRequest.newBuilder() - .uri(URI.create(opt.getZipLink())) - .build(); - try { - HttpResponse response = client.send(request, - HttpResponse.BodyHandlers.ofFileDownload(Path.of(opt.getDownloadPath()), StandardOpenOption.CREATE, StandardOpenOption.WRITE)); - System.out.println(response.statusCode()); - System.out.println(response.headers()); - Path path = response.body(); - System.out.println("Path = " + path); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } - - public static void main(String[] args) { - SourceListener ear = new SourceListener(); - // try { - // ear.download(); - // ear.extract(); - // } catch (IOException e) { - // System.out.println(e.getMessage()); - // } - ear.isUpdated(); - } -} diff --git a/src/main/java/ru/molokoin/sourceListener/RepoCrafter.java b/src/main/java/ru/molokoin/sourceListener/git/RepoCrafter.java similarity index 80% rename from src/main/java/ru/molokoin/sourceListener/RepoCrafter.java rename to src/main/java/ru/molokoin/sourceListener/git/RepoCrafter.java index fc17eb4..931ba1e 100644 --- a/src/main/java/ru/molokoin/sourceListener/RepoCrafter.java +++ b/src/main/java/ru/molokoin/sourceListener/git/RepoCrafter.java @@ -1,8 +1,7 @@ -package ru.molokoin.sourceListener; +package ru.molokoin.sourceListener.git; import java.io.File; import java.io.IOException; -import java.nio.file.Path; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.errors.GitAPIException; @@ -10,8 +9,6 @@ import org.eclipse.jgit.api.errors.InvalidRemoteException; import org.eclipse.jgit.api.errors.TransportException; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.storage.file.FileRepositoryBuilder; -import org.eclipse.jgit.util.FileUtils; - public class RepoCrafter { @@ -36,10 +33,10 @@ public class RepoCrafter { return repository; } - public static Repository copy(String gitLink, File localPath) throws IOException, InvalidRemoteException, TransportException, GitAPIException{ + public static Repository copy(String gitLink, String localPath) throws IOException, InvalidRemoteException, TransportException, GitAPIException{ // prepare a new folder for the cloned repository - //File localPath = new File(locationPath); - if(!localPath.delete()) { + File localFile = new File(localPath); + if(!localFile.delete()) { throw new IOException("Could not delete temporary file " + localPath); } @@ -47,7 +44,7 @@ public class RepoCrafter { System.out.println("Cloning from " + gitLink + " to " + localPath); Git result = Git.cloneRepository() .setURI(gitLink) - .setDirectory(localPath) + .setDirectory(localFile) //.setProgressMonitor(new SimpleProgressMonitor()) .call(); // Note: the call() returns an opened repository already which needs to be closed to avoid file handle leaks! diff --git a/src/main/java/ru/molokoin/sourceListener/net/Service.java b/src/main/java/ru/molokoin/sourceListener/net/Service.java new file mode 100644 index 0000000..1b1d5a5 --- /dev/null +++ b/src/main/java/ru/molokoin/sourceListener/net/Service.java @@ -0,0 +1,32 @@ +package ru.molokoin.sourceListener.net; + +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.file.Path; +import java.nio.file.StandardOpenOption; + +public class Service { + /** + * Метод cкачивает файл c удаленного ресурса и размещает в указанной папке на локальном устройстве + * @param sourceLink + * @param localPath + */ + public static void download(String sourceLink, String localPath){ + HttpClient client = HttpClient.newHttpClient(); + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create(sourceLink)) + .build(); + try { + HttpResponse response = client.send(request, + HttpResponse.BodyHandlers.ofFileDownload(Path.of(localPath), StandardOpenOption.CREATE, StandardOpenOption.WRITE)); + System.out.println(response.statusCode()); + System.out.println(response.headers()); + Path path = response.body(); + System.out.println("Path = " + path); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } +} diff --git a/src/main/java/ru/molokoin/sourceListener/Options.java b/src/main/java/ru/molokoin/sourceListener/opt/Options.java similarity index 94% rename from src/main/java/ru/molokoin/sourceListener/Options.java rename to src/main/java/ru/molokoin/sourceListener/opt/Options.java index f34a266..2dc40d4 100644 --- a/src/main/java/ru/molokoin/sourceListener/Options.java +++ b/src/main/java/ru/molokoin/sourceListener/opt/Options.java @@ -1,4 +1,4 @@ -package ru.molokoin.sourceListener; +package ru.molokoin.sourceListener.opt; public class Options { private String zipLink; diff --git a/target/classes/ru/molokoin/sourceListener/GitListener.class b/target/classes/ru/molokoin/sourceListener/GitListener.class new file mode 100644 index 0000000..82b0225 Binary files /dev/null and b/target/classes/ru/molokoin/sourceListener/GitListener.class differ diff --git a/target/classes/ru/molokoin/sourceListener/RepoCrafter.class b/target/classes/ru/molokoin/sourceListener/RepoCrafter.class deleted file mode 100644 index 0f805e2..0000000 Binary files a/target/classes/ru/molokoin/sourceListener/RepoCrafter.class and /dev/null differ diff --git a/target/classes/ru/molokoin/sourceListener/SourceListener.class b/target/classes/ru/molokoin/sourceListener/SourceListener.class deleted file mode 100644 index da05094..0000000 Binary files a/target/classes/ru/molokoin/sourceListener/SourceListener.class and /dev/null differ diff --git a/target/classes/ru/molokoin/sourceListener/git/RepoCrafter.class b/target/classes/ru/molokoin/sourceListener/git/RepoCrafter.class new file mode 100644 index 0000000..ceebf36 Binary files /dev/null and b/target/classes/ru/molokoin/sourceListener/git/RepoCrafter.class differ diff --git a/target/classes/ru/molokoin/sourceListener/net/Service.class b/target/classes/ru/molokoin/sourceListener/net/Service.class new file mode 100644 index 0000000..bdcd286 Binary files /dev/null and b/target/classes/ru/molokoin/sourceListener/net/Service.class differ diff --git a/target/classes/ru/molokoin/sourceListener/Options.class b/target/classes/ru/molokoin/sourceListener/opt/Options.class similarity index 85% rename from target/classes/ru/molokoin/sourceListener/Options.class rename to target/classes/ru/molokoin/sourceListener/opt/Options.class index 5a66e28..7148244 100644 Binary files a/target/classes/ru/molokoin/sourceListener/Options.class and b/target/classes/ru/molokoin/sourceListener/opt/Options.class differ