• R/O
  • SSH
  • HTTPS

catalpa: Commit


Commit MetaInfo

Revision124 (tree)
Time2022-10-28 16:01:49
Authorhirukawa_ryo

Log Message

0.9.1
依存ライブラリ fx-util 0.4.7 -> 0.4.8
brotli, zopfli, gzip 圧縮機能を廃止しました。

Change Summary

Incremental Difference

--- catalpa/trunk/src/main/java/net/osdn/catalpa/Zopfli.java (revision 123)
+++ catalpa/trunk/src/main/java/net/osdn/catalpa/Zopfli.java (nonexistent)
@@ -1,23 +0,0 @@
1-package net.osdn.catalpa;
2-
3-import java.util.Arrays;
4-
5-import lu.luz.jzopfli.Zopfli_lib;
6-import lu.luz.jzopfli.ZopfliH.ZopfliFormat;
7-import lu.luz.jzopfli.ZopfliH.ZopfliOptions;
8-
9-public class Zopfli {
10-
11- public static byte[] compress(byte[] data) {
12- ZopfliOptions options = new ZopfliOptions();
13- ZopfliFormat output_type = ZopfliFormat.ZOPFLI_FORMAT_GZIP;
14- byte[][] out = { { 0 } };
15- int[] outsize = { 0 };
16-
17- Zopfli_lib.ZopfliCompress(
18- options, output_type, data, data.length, out, outsize);
19-
20- return Arrays.copyOf(out[0], outsize[0]);
21- }
22-
23-}
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- catalpa/trunk/src/main/java/net/osdn/catalpa/ui/javafx/MainApp.java (revision 123)
+++ catalpa/trunk/src/main/java/net/osdn/catalpa/ui/javafx/MainApp.java (revision 124)
@@ -499,10 +499,10 @@
499499 }
500500 if(isModified) {
501501 // ファイル変更イベントは連続で発生するので
502- // 600ミリ秒以上連続でイベントが発生しなくなってから処理を開始します。
502+ // 1000ミリ秒以上連続でイベントが発生しなくなってから処理を開始します。
503503 // (たとえばファイルを書き換えると DELETE + CREATE で2回ファイル変更イベントが連続発生することがあります。)
504504 LocalDateTime t = this.lastModified = LocalDateTime.now();
505- FxApplicationThread.runLater(600, Unchecked.runnable(() -> {
505+ FxApplicationThread.runLater(1000, Unchecked.runnable(() -> {
506506 if(t.equals(lastModified) && inputPath.getValue() != null) {
507507 if(busy.get()) {
508508 // 更新や保存処理中は更新が検出されても無視します。
@@ -617,7 +617,7 @@
617617
618618 protected void upload(Path inputPath) {
619619 progressOffset = 0.0;
620- progressScale = 0.5;
620+ progressScale = 0.4;
621621 progressBar.setProgress(0.0);
622622 progressLabel.setText("");
623623
@@ -629,7 +629,8 @@
629629 Catalpa catalpa = new Catalpa(inputPath);
630630 Map<String, Object> options = new HashMap<String, Object>();
631631 catalpa.process(outputPath, options, this);
632- progressOffset = 0.5;
632+ progressOffset = 0.4;
633+ progressScale = 0.6;
633634 uploadConfig.get().upload(outputPath.toFile(), this);
634635 }).onSucceeded(unused -> {
635636 toast.show(Toast.GREEN, "アップロードが完了しました", Toast.LONG);
--- catalpa/trunk/src/main/java/net/osdn/catalpa/upload/firebase/FirebaseUploader.java (revision 123)
+++ catalpa/trunk/src/main/java/net/osdn/catalpa/upload/firebase/FirebaseUploader.java (revision 124)
@@ -83,6 +83,8 @@
8383 byte[] buf = new byte[65536];
8484 try(Stream<Path> stream = Files.walk(input)) {
8585 List<Path> list = stream.toList();
86+ progress = 0;
87+ maxProgress = list.size();
8688 for(Path path : list) {
8789 if(Files.isDirectory(path)) {
8890 Path dirname = input.relativize(path);
@@ -100,6 +102,7 @@
100102 String hash = getSHA256(sha256, output.resolve(file));
101103 files.put(file, hash);
102104 }
105+ this.observer.setProgress((++progress / (double)maxProgress) * 0.4);
103106 }
104107 }
105108
@@ -125,7 +128,7 @@
125128 CompletableFuture<HttpResponse<String>> future = upload(client, token, url, output.resolve(file));
126129 future.thenAccept(response -> {
127130 if(response.statusCode() == 200) {
128- this.observer.setProgress(++progress / (double)maxProgress);
131+ this.observer.setProgress(0.4 + (++progress / (double)maxProgress) * 0.6);
129132 this.observer.setText("/" + file.toString().replace('\\', '/'));
130133 }
131134 });
@@ -134,6 +137,7 @@
134137 CompletableFuture.allOf(futures).get();
135138 }
136139
140+ this.observer.setProgress(1.0);
137141 finalizeVersion(client, token, siteId, versionId);
138142 releaseVersion(client, token, siteId, versionId);
139143 }
--- catalpa/trunk/src/main/java/net/osdn/catalpa/Catalpa.java (revision 123)
+++ catalpa/trunk/src/main/java/net/osdn/catalpa/Catalpa.java (revision 124)
@@ -26,19 +26,15 @@
2626 import java.util.Collections;
2727 import java.util.Comparator;
2828 import java.util.HashMap;
29-import java.util.HashSet;
3029 import java.util.Iterator;
3130 import java.util.List;
3231 import java.util.Map;
3332 import java.util.Map.Entry;
34-import java.util.Set;
3533 import java.util.stream.Collectors;
3634 import java.util.stream.Stream;
3735
3836 import com.vladsch.flexmark.util.data.MutableDataSet;
3937 import com.vladsch.flexmark.util.misc.Extension;
40-import org.brotli.wrapper.Brotli;
41-import org.brotli.wrapper.enc.Encoder;
4238
4339 import com.vladsch.flexmark.ext.attributes.AttributesExtension;
4440 import com.vladsch.flexmark.ext.definition.DefinitionExtension;
@@ -76,11 +72,7 @@
7672 import net.osdn.util.io.AutoDetectReader;
7773
7874 public class Catalpa {
79-
80- static {
81- Brotli.loadLibrary();
82- }
83-
75+
8476 public static final String CONFIG_FILENAME = "config.yml";
8577
8678 private static final List<Handler> DEFAULT_HANDLERS = Arrays.asList(
@@ -119,8 +111,6 @@
119111 private Configuration freeMarker;
120112 private List<SitemapItem> sitemap = new ArrayList<SitemapItem>();
121113 private List<SearchIndex> searchIndexes;
122- private Set<String> compressionTargets = new HashSet<String>();
123- private Set<String> compressionFormats = new HashSet<String>();
124114 private ProgressObserver observer;
125115 private int progress;
126116 private int maxProgress;
@@ -223,25 +213,6 @@
223213 if(Files.exists(filename) && !Files.isDirectory(filename)) {
224214 config = context.load(filename);
225215 type = config.get("type") != null ? config.get("type").toString() : null;
226-
227-
228- compressionTargets.clear();
229- compressionFormats.clear();
230- if(!Boolean.TRUE.equals(options.get("_PREVIEW"))) {
231- for(String s : Util.getValues(config, "compression.target")) {
232- if(s.startsWith(".")) {
233- s = s.substring(1);
234- }
235- compressionTargets.add(s.toLowerCase());
236- }
237- for(String s : Util.getValues(config, "compression.format")) {
238- if(s.startsWith(".")) {
239- s = s.substring(1);
240- }
241- compressionFormats.add(s.toLowerCase());
242- }
243- }
244-
245216 addon = getApplicableAddOn(type);
246217 }
247218 if(addon != null) {
@@ -451,24 +422,7 @@
451422 }
452423
453424 public void write(Path path, byte[] bytes) throws IOException {
454-
455425 Files.write(path, bytes);
456-
457- String ext = Util.getFileExtension(path);
458- if(compressionTargets.contains(ext)) {
459- for(String format : compressionFormats) {
460- byte[] data = null;
461- if(format.equals("gz") || format.equals("gzip")) {
462- data = Zopfli.compress(bytes);
463- } else if(format.equals("br") || format.equals("brotli")) {
464- data = Encoder.compress(bytes);
465- }
466- if(data != null) {
467- Path p = path.resolveSibling(path.getFileName().toString() + "." + format);
468- Files.write(p, data);
469- }
470- }
471- }
472426 }
473427
474428 protected void copyRecursively(Path src, Path dst) throws IOException {
@@ -498,14 +452,9 @@
498452 return;
499453 }
500454
501- String ext = Util.getFileExtension(dst);
502- if(compressionTargets.contains(ext)) {
503- write(dst, Files.readAllBytes(src));
504- } else {
505- Files.copy(src, dst,
506- StandardCopyOption.REPLACE_EXISTING,
507- StandardCopyOption.COPY_ATTRIBUTES);
508- }
455+ Files.copy(src, dst,
456+ StandardCopyOption.REPLACE_EXISTING,
457+ StandardCopyOption.COPY_ATTRIBUTES);
509458 }
510459
511460 protected SitemapItem createSitemapItem(Context context) throws IOException {
Show on old repository browser