From e09274eb80af691af0feb9c774bd0517bb92e381 Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 31 May 2019 17:17:59 +0200 Subject: Web interface --- http/index.html | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 http/index.html (limited to 'http/index.html') diff --git a/http/index.html b/http/index.html new file mode 100644 index 0000000..faebaff --- /dev/null +++ b/http/index.html @@ -0,0 +1,122 @@ + + + + DealConvert by mkl + + + + + + + +
+ +
+
+
+
+ + +
+
+ +
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+ + +
+
+
+ + + + + + -- cgit v1.2.3 From e7f7ae45b7dfd45a8b2ac0603a501273a5f10b2d Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 31 May 2019 18:22:53 +0200 Subject: FAQ --- http/dealconvert.js | 1 + http/index.html | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) (limited to 'http/index.html') diff --git a/http/dealconvert.js b/http/dealconvert.js index 3e5ea85..ff25444 100644 --- a/http/dealconvert.js +++ b/http/dealconvert.js @@ -1,4 +1,5 @@ $(document).ready(function() { + $('a.faq-btn').popover(); $('input[name="output"]').change(function() { if ($('input[name="output"]:checked').length > 0) { $('#submit-btn').removeAttr('disabled'); diff --git a/http/index.html b/http/index.html index faebaff..fb97c5e 100644 --- a/http/index.html +++ b/http/index.html @@ -1,6 +1,7 @@ + DealConvert by mkl @@ -11,10 +12,62 @@
+
+
+
+ Pytania i odpowiedzi +
+
+
+
Czemu konwerter mi nie zadziałał?
+
+ Nie wiem, prześlij mi problemowy plik z opisem błędu mailem albo od razu do systemu śledzenia błędów.
+ Pliki wszystkich formatów wygenerowane poprawnie i z ciągłą numeracją rozdań od 1 (np. wygenerowane przez BigDeala) powinny konwertować się we wszystkie strony bez problemu. Nie wszystkie formaty plików są udokumentowane w sposób pozwalający obsłużyć je kompleksowo, na przykład formaty DUP i DLM (stary i nowy format Duplimate) zawierają dużo opcji, które konwerter ignoruje, a czasami wręcz wprost przyznaje, że nie wie, jak się zachować. Jeśli masz jakieś informacje, które mogłyby usprawnić wsparcie takich formatów, pisz jak wyżej. +
+
Czemu konwerter nie wspiera formatu X?
+
+ Bo nie obsługiwał go BigDeal w momencie, kiedy konwerter powstawał.
+ Wyjątkiem są "ślepe" formaty Duplimate, które były wyodrębione w BigDeal, ale nie są obsługiwane, a różnią się od "jawnych" formatów Duplimate tylko określonymi opcjami. Oba te formaty są prawidłowo importowane, konwerter zapisuje jednak tylko do plików "jawnych".
+ W przyszłości rozważane jest wsparcie dla formatu LIN. Jeśli chcesz obsługi jakiegoś innego formatu, pisz jak wyżej. +
+
Czemu w pliku PBN nie ma analizy w widne?
+
Nie ma, pracuję nad tym. Możesz ją sobie łatwo (i szybko!) wykonać przy pomocy BCDD.
+
Czemu dostaję mnóstwo ostrzeżeń .xxx file format assumes consequent deal numbers from 1?
+
Niektóre formaty nie przechowują numerów rozdań. W takich sytuacjach, zarówno przy imporcie, jak i eksporcie, konwerter zakłada, że rozdania mają kolejne numery, od 1. Może to doprowadzić do zmiany numeracji rozdań, jeśli oryginalny plik nie zaczynał się od rozdania nr 1 albo numeracja zawierała dziury.
+
Czemu mój PBN nie chce się otworzyć w BigDealu?
+
+ BigDeal zakłada, że numeracja rozdań w pliku PBN zaczyna się od 1. Możliwy jest eksport do PBN plików, które nie spełniają tego warunku (np. formaty Duplimate robią tak powszechnie).
+ Jest łatwy sposób, aby poradzić sobie z tym problemem: +
    +
  1. Wyeksportować rozkłady do plik DLM.
  2. +
  3. Odnaleźć w pliku DLM linię From board=X.
  4. +
  5. Zmienić ją na From board=1.
  6. +
  7. Tak spreparowany plik skonwertować do PBN.
  8. +
  9. Prawdopodobnie konwerter zgłosi błąd sumy kontrolnej, można go ignorować, jeśli nie chce się używać pośredniego pliku DLM.
  10. +
  11. Wynikowy plik PBN rozpoczyna się od rozdania nr 1 i jest uzupełniony rozdaniami z 13-kartowymi kolorami w każdej z rąk.
  12. +
+
Czy to bezpieczne, tak wysyłać rozkłady do Internetu?
+
+ Doskonałe pytanie!
+ Nie jestem oczywiście w stanie zapewnić, że przesyłane w ten sposób rozkłady są w 100% odporne na wyciek, ale ze strony konwertera: +
    +
  • zapewniam szyfrowane połączenie HTTPS
  • +
  • udostępniam kod źródłowy całości narzędzia
  • +
  • nie przechowuję oryginalnych plików wejściowych na serwerze
  • +
  • pliki wynikowe przechowuję przez 15 minut od momentu wygenerowania
  • +
  • pliki wynikowe dostępne są tylko w tej samej sesji przeglądarki, w której zostały wygenerowane
  • +
+ Ogólnie, jeśli zachować elementarne środki ostrożności, tj. niekorzystanie z konwertera w niezaufanych sieciach oraz z niezaufanych komputerów, konwerter niesie dużo mniejsze ryzyko niż np. zostawienie rozkładów na pamięci przenośnej na sali gry czy wysyłanie ich pocztą elektroniczną. +
+
+
+
+
-- cgit v1.2.3 From a9944c178f13ed6fd876a8757a147ca5949d6423 Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 31 May 2019 20:51:05 +0200 Subject: Board preview feature --- http/api/api.py | 16 +++++++++ http/dealconvert.js | 22 +++++++++++-- http/img/e-ew.png | Bin 0 -> 5657 bytes http/img/e-ns-ew.png | Bin 0 -> 5952 bytes http/img/e-ns.png | Bin 0 -> 5674 bytes http/img/e.png | Bin 0 -> 5267 bytes http/img/n-ew.png | Bin 0 -> 5577 bytes http/img/n-ns-ew.png | Bin 0 -> 5955 bytes http/img/n-ns.png | Bin 0 -> 5731 bytes http/img/n.png | Bin 0 -> 5247 bytes http/img/s-ew.png | Bin 0 -> 5558 bytes http/img/s-ns-ew.png | Bin 0 -> 5936 bytes http/img/s-ns.png | Bin 0 -> 5688 bytes http/img/s.png | Bin 0 -> 5250 bytes http/img/w-ew.png | Bin 0 -> 5595 bytes http/img/w-ns-ew.png | Bin 0 -> 5901 bytes http/img/w-ns.png | Bin 0 -> 5602 bytes http/img/w.png | Bin 0 -> 5207 bytes http/index.html | 89 ++++++++++++++++++++++++++++++++++++++++++++++++--- 19 files changed, 120 insertions(+), 7 deletions(-) create mode 100644 http/img/e-ew.png create mode 100644 http/img/e-ns-ew.png create mode 100644 http/img/e-ns.png create mode 100644 http/img/e.png create mode 100644 http/img/n-ew.png create mode 100644 http/img/n-ns-ew.png create mode 100644 http/img/n-ns.png create mode 100644 http/img/n.png create mode 100644 http/img/s-ew.png create mode 100644 http/img/s-ns-ew.png create mode 100644 http/img/s-ns.png create mode 100644 http/img/s.png create mode 100644 http/img/w-ew.png create mode 100644 http/img/w-ns-ew.png create mode 100644 http/img/w-ns.png create mode 100644 http/img/w.png (limited to 'http/index.html') diff --git a/http/api/api.py b/http/api/api.py index 1c1cb0f..be2635f 100644 --- a/http/api/api.py +++ b/http/api/api.py @@ -63,6 +63,22 @@ def handle_upload(response, request): input_file.close() if not len(dealset): raise RuntimeError('Dealset is empty') + if params['display_deals']: + preview_obj = [] + for board in dealset: + deal_preview = { + 'number': board.number, + 'conditions': 'nesw'[board.dealer], + 'hands': [] + } + for pair in ['ns', 'ew']: + if board.vulnerable[pair.upper()]: + deal_preview['conditions'] += '-' + pair + deal_preview['hands'] = board.hands + preview_obj.append(deal_preview) + return_obj['preview'] = preview_obj + else: + return_obj['preview'] = None except RuntimeError as e: return_obj['error'] = unicode(e) return _print_response(response, return_obj) diff --git a/http/dealconvert.js b/http/dealconvert.js index ff25444..e038b58 100644 --- a/http/dealconvert.js +++ b/http/dealconvert.js @@ -52,9 +52,9 @@ $(document).ready(function() { var warningTemplate = $('template#file-output-warning'); var errorTemplate = $('template#file-output-error'); var fileTemplate = $('template#file-output'); - var inputHeader = outputGroup.find('.card-header'); + var inputHeader = outputGroup.find('.file-header'); inputHeader.text(data.name); - var groupBody = outputGroup.find('.card-body'); + var groupBody = outputGroup.find('.file-body'); if (data.error) { inputHeader.addClass('bg-danger'); groupBody.append(errorTemplate.clone().contents().unwrap().text(data.error)); @@ -94,6 +94,24 @@ $(document).ready(function() { ); } } + if (data.preview) { + var boardTemplate = $('#board-preview'); + var hands = ['north', 'east', 'south', 'west']; + var suits = ['spades', 'hearts', 'diamonds', 'clubs']; + for (var b = 0; b < data.preview.length; b++) { + var board = boardTemplate.clone().contents().unwrap(); + board.find('.board-number').text(data.preview[b].number); + board.find('.board-conditions').attr('src', 'img/' + data.preview[b].conditions + '.png'); + for (var h = 0; h < hands.length; h++) { + for (var s = 0; s < suits.length; s++) { + board.find('.board-' + hands[h] + '-' + suits[s]).text(data.preview[b].hands[h][s].join('')); + } + } + outputGroup.find('.file-boards-panel .board-body').append(board); + } + } else { + outputGroup.find('.file-boards-panel').remove(); + } } $('body').append(outputGroup); completed += 1; diff --git a/http/img/e-ew.png b/http/img/e-ew.png new file mode 100644 index 0000000..bbf899f Binary files /dev/null and b/http/img/e-ew.png differ diff --git a/http/img/e-ns-ew.png b/http/img/e-ns-ew.png new file mode 100644 index 0000000..05a3b6c Binary files /dev/null and b/http/img/e-ns-ew.png differ diff --git a/http/img/e-ns.png b/http/img/e-ns.png new file mode 100644 index 0000000..2e94563 Binary files /dev/null and b/http/img/e-ns.png differ diff --git a/http/img/e.png b/http/img/e.png new file mode 100644 index 0000000..0d9304b Binary files /dev/null and b/http/img/e.png differ diff --git a/http/img/n-ew.png b/http/img/n-ew.png new file mode 100644 index 0000000..8cc1807 Binary files /dev/null and b/http/img/n-ew.png differ diff --git a/http/img/n-ns-ew.png b/http/img/n-ns-ew.png new file mode 100644 index 0000000..d45ef7e Binary files /dev/null and b/http/img/n-ns-ew.png differ diff --git a/http/img/n-ns.png b/http/img/n-ns.png new file mode 100644 index 0000000..a94eb42 Binary files /dev/null and b/http/img/n-ns.png differ diff --git a/http/img/n.png b/http/img/n.png new file mode 100644 index 0000000..cb079c4 Binary files /dev/null and b/http/img/n.png differ diff --git a/http/img/s-ew.png b/http/img/s-ew.png new file mode 100644 index 0000000..44c3e71 Binary files /dev/null and b/http/img/s-ew.png differ diff --git a/http/img/s-ns-ew.png b/http/img/s-ns-ew.png new file mode 100644 index 0000000..8cff6f8 Binary files /dev/null and b/http/img/s-ns-ew.png differ diff --git a/http/img/s-ns.png b/http/img/s-ns.png new file mode 100644 index 0000000..36fe441 Binary files /dev/null and b/http/img/s-ns.png differ diff --git a/http/img/s.png b/http/img/s.png new file mode 100644 index 0000000..a0611ac Binary files /dev/null and b/http/img/s.png differ diff --git a/http/img/w-ew.png b/http/img/w-ew.png new file mode 100644 index 0000000..b66f4f9 Binary files /dev/null and b/http/img/w-ew.png differ diff --git a/http/img/w-ns-ew.png b/http/img/w-ns-ew.png new file mode 100644 index 0000000..448abf2 Binary files /dev/null and b/http/img/w-ns-ew.png differ diff --git a/http/img/w-ns.png b/http/img/w-ns.png new file mode 100644 index 0000000..623a641 Binary files /dev/null and b/http/img/w-ns.png differ diff --git a/http/img/w.png b/http/img/w.png new file mode 100644 index 0000000..6a995ad Binary files /dev/null and b/http/img/w.png differ diff --git a/http/index.html b/http/index.html index fb97c5e..82c3dc8 100644 --- a/http/index.html +++ b/http/index.html @@ -9,7 +9,7 @@ - +
-
@@ -171,5 +178,77 @@ + -- cgit v1.2.3 From e3e5c088687d73dc492199be071cc12d786ba00d Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 4 Jun 2019 23:32:43 +0200 Subject: Collapsing/exapnding output option sections after files are selected --- http/dealconvert.js | 3 +++ http/index.html | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'http/index.html') diff --git a/http/dealconvert.js b/http/dealconvert.js index e038b58..2478fe9 100644 --- a/http/dealconvert.js +++ b/http/dealconvert.js @@ -7,6 +7,9 @@ $(document).ready(function() { $('#submit-btn').attr('disabled', 'disabled'); } }); + $('#input-files').change(function() { + $('#submit-panel, #output-formats').collapse(this.files.length ? 'show' : 'hide'); + }); $('#converter-input').submit(function() { var that = $(this); var output = []; diff --git a/http/index.html b/http/index.html index 82c3dc8..9f40cf1 100644 --- a/http/index.html +++ b/http/index.html @@ -74,7 +74,7 @@
-
+
@@ -139,7 +139,7 @@
-
+
-- cgit v1.2.3