You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2016/09/06 16:51:01 UTC

[whimsy] branch master updated (969851d -> a847310)

This is an automated email from the ASF dual-hosted git repository.

rubys pushed a change to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git.

      from  969851d   not all mailing lists match pmc name
       new  33de297   update react
       new  18b685f   timestamp css file
       new  8214ede   rough in tabs
       new  50bdce0   cleanup edit part
       new  a847310   screen dangerous content

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 www/secmail/public/assets/react-min.js   |  12 ++--
 www/secmail/public/secmail.css           |  33 +++++++---
 www/secmail/server.rb                    |  26 ++++++++
 www/secmail/views/actions/icla.json.rb   |  33 ++++++----
 www/secmail/views/app.js.rb              |   4 ++
 www/secmail/views/danger.html.rb         |  21 ++++++
 www/secmail/views/forms/icla.js.rb       |   2 +
 www/secmail/views/forms/incomplete.js.rb |   2 +-
 www/secmail/views/forms/pubkey.rb        |   5 ++
 www/secmail/views/forms/unsigned.js.rb   |   2 +-
 www/secmail/views/index.html.rb          |   2 +-
 www/secmail/views/parts.html.rb          |   8 ++-
 www/secmail/views/parts.js.rb            | 107 ++++++++++++++++++++++---------
 13 files changed, 193 insertions(+), 64 deletions(-)
 create mode 100644 www/secmail/views/danger.html.rb
 create mode 100644 www/secmail/views/forms/pubkey.rb

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].

[whimsy] 03/05: rough in tabs

Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

commit 8214ede80208299fb393d781536df148a53bf4a7
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Tue Sep 6 11:52:26 2016 -0400

    rough in tabs
---
 www/secmail/public/secmail.css           | 17 +++---
 www/secmail/server.rb                    | 13 +++++
 www/secmail/views/actions/icla.json.rb   | 33 +++++++-----
 www/secmail/views/app.js.rb              |  4 ++
 www/secmail/views/forms/icla.js.rb       |  2 +
 www/secmail/views/forms/incomplete.js.rb |  2 +-
 www/secmail/views/forms/pubkey.rb        |  5 ++
 www/secmail/views/forms/unsigned.js.rb   |  2 +-
 www/secmail/views/parts.html.rb          |  5 +-
 www/secmail/views/parts.js.rb            | 93 +++++++++++++++++++++++---------
 10 files changed, 127 insertions(+), 49 deletions(-)

diff --git a/www/secmail/public/secmail.css b/www/secmail/public/secmail.css
index 3d3c200..18dcb5a 100644
--- a/www/secmail/public/secmail.css
+++ b/www/secmail/public/secmail.css
@@ -33,12 +33,17 @@
   opacity: 0.5;
 }
 
-table.doctype {
-  width: 100%;
+.doctype label {
+  display: block
 }
 
-table.doctype td {
-  text-align: center;
+.doctype input[type=radio] {
+  width: 3em
+}
+
+#parts h4 {
+  padding: 10px 1em;
+  background-color: #d9e9f7;
 }
 
 table.form {
@@ -67,11 +72,11 @@ form .btn {
   margin-top: 0.5em;
 }
 
-#attachments li {
+#attachments li.attachment {
   width: 100%
 }
 
-#attachments div.buttons {
+#parts div.buttons {
   text-align: center;
   margin: 1em 0;
 }
diff --git a/www/secmail/server.rb b/www/secmail/server.rb
index 4dbec18..3e22214 100644
--- a/www/secmail/server.rb
+++ b/www/secmail/server.rb
@@ -14,6 +14,13 @@ require_relative 'models/mailbox'
 require_relative 'models/safetemp'
 require_relative 'models/events'
 
+class Wunderbar::JsonBuilder
+  def _task(title, &block)
+    @_target[:tasklist] ||= []
+    @_target[:tasklist] << title
+  end
+end
+
 # list of messages
 get '/' do
   # determine latest month for which there are messages
@@ -41,6 +48,12 @@ get %r{^/(\d{6})/(\w+)/$} do |month, hash|
   _html :message
 end
 
+# task lists
+post '/tasklist/:file' do
+  @tasklist = JSON.parse(_json :"actions/#{params[:file]}")['tasklist']
+  _html :tasklist
+end
+
 # posted actions
 post '/actions/:file' do
   _json :"actions/#{params[:file]}"
diff --git a/www/secmail/views/actions/icla.json.rb b/www/secmail/views/actions/icla.json.rb
index d90d4a9..8d3a065 100644
--- a/www/secmail/views/actions/icla.json.rb
+++ b/www/secmail/views/actions/icla.json.rb
@@ -6,21 +6,26 @@ message = Mailbox.find(@message)
 iclas = ASF::SVN['private/documents/iclas']
 
 # write attachment (+ signature, if present) to the documents/iclas directory
-svn_reset iclas
-dest = message.write_svn(iclas, @filename, @selected, @signature)
+task "svn commit #{@filename}" do
+  svn_reset iclas
+  dest = message.write_svn(iclas, @filename, @selected, @signature)
+end
 
-# construct line to be inserted
-insert = [
-  'notinavail',
-  @realname.strip,
-  @pubname.strip,
-  @email.strip,
-  "Signed CLA;#{@filename}"
-].join(':')
+# insert line into iclas.txt
+task "svn commit iclas.txt" do
+  # construct line to be inserted
+  insert = [
+    'notinavail',
+    @realname.strip,
+    @pubname.strip,
+    @email.strip,
+    "Signed CLA;#{@filename}"
+  ].join(':')
 
-# update iclas.txt
-svn_reset ASF::ICLA::OFFICERS
-iclas_txt = ASF::ICLA.sort(File.read(ASF::ICLA::SOURCE) + insert + "\n")
-File.write ASF::ICLA::SOURCE, iclas_txt
+  # update iclas.txt
+  svn_reset ASF::ICLA::OFFICERS
+  iclas_txt = ASF::ICLA.sort(File.read(ASF::ICLA::SOURCE) + insert + "\n")
+  File.write ASF::ICLA::SOURCE, iclas_txt
+end
 
 {result: "stub for ICLA, filename: #{@filename}"}
diff --git a/www/secmail/views/app.js.rb b/www/secmail/views/app.js.rb
index 773cdef..072d7d3 100644
--- a/www/secmail/views/app.js.rb
+++ b/www/secmail/views/app.js.rb
@@ -11,3 +11,7 @@ require_relative 'forms/grant'
 require_relative 'forms/ccla'
 require_relative 'forms/nda'
 require_relative 'forms/memapp'
+
+require_relative 'forms/incomplete'
+require_relative 'forms/unsigned'
+require_relative 'forms/pubkey'
diff --git a/www/secmail/views/forms/icla.js.rb b/www/secmail/views/forms/icla.js.rb
index 53eea0f..1b06431 100644
--- a/www/secmail/views/forms/icla.js.rb
+++ b/www/secmail/views/forms/icla.js.rb
@@ -6,6 +6,8 @@ class ICLA < React
   end
 
   def render
+    _h4 'ICLA'
+
     _form action: '../../actions/icla', method: 'post', onSubmit: self.file do
       _table.form do
         _tr do
diff --git a/www/secmail/views/forms/incomplete.js.rb b/www/secmail/views/forms/incomplete.js.rb
index 609de64..004ca9c 100644
--- a/www/secmail/views/forms/incomplete.js.rb
+++ b/www/secmail/views/forms/incomplete.js.rb
@@ -1,4 +1,4 @@
-class INCOMPLETE < React
+class Incomplete < React
   def render
     _p 'INCOMPLETE'
   end
diff --git a/www/secmail/views/forms/pubkey.rb b/www/secmail/views/forms/pubkey.rb
new file mode 100644
index 0000000..80344b1
--- /dev/null
+++ b/www/secmail/views/forms/pubkey.rb
@@ -0,0 +1,5 @@
+class PubKey < React
+  def render
+    _p 'Public Key'
+  end
+end
diff --git a/www/secmail/views/forms/unsigned.js.rb b/www/secmail/views/forms/unsigned.js.rb
index e0e3915..046acc0 100644
--- a/www/secmail/views/forms/unsigned.js.rb
+++ b/www/secmail/views/forms/unsigned.js.rb
@@ -1,4 +1,4 @@
-class UNSIGNED < React
+class Unsigned < React
   def render
     _p 'UNSIGNED'
   end
diff --git a/www/secmail/views/parts.html.rb b/www/secmail/views/parts.html.rb
index 60c7551..f487b1a 100644
--- a/www/secmail/views/parts.html.rb
+++ b/www/secmail/views/parts.html.rb
@@ -12,12 +12,13 @@ _html do
     _li! {_a 'raw', href: '_raw_', target: 'content'}
   end
 
-  _div.attachments!
+  _div.parts!
 
   _script src: '../../app.js'
-  _.render '#attachments' do
+  _.render '#parts' do
     _Parts attachments: @attachments, headers: @headers
   end
+
   _h4_ 'Links'
   _ul do
     _li do
diff --git a/www/secmail/views/parts.js.rb b/www/secmail/views/parts.js.rb
index 7171f81..2782fc6 100644
--- a/www/secmail/views/parts.js.rb
+++ b/www/secmail/views/parts.js.rb
@@ -9,7 +9,7 @@ class Parts < React
     @busy = false
     @attachments = []
     @drag = nil
-    @form = nil
+    @form = :categorize
     @menu = nil
   end
 
@@ -35,7 +35,7 @@ class Parts < React
     signature = CheckSignature.find(@selected, @attachments)
 
     # list of attachments
-    _ul @attachments, ref: 'attachments' do |attachment|
+    _ul.attachments! @attachments, ref: 'attachments' do |attachment|
       if attachment == @drag
         options[:className] = 'dragging'
       elsif attachment == @selected
@@ -67,51 +67,94 @@ class Parts < React
       _CheckSignature selected: @selected, attachments: @attachments,
         headers: @@headers
 
-      # filing options
-      _table.doctype do
-        _tr do
-          _td do
+      _ul.nav.nav_tabs do
+        _li class: ('active' unless @form == :edit) do
+          _a 'Categorize', onMouseDown: self.tabSelect
+        end
+        _li class: ('active' if @form == :edit) do
+          _a 'Edit', onMouseDown: self.tabSelect
+        end
+      end
+
+      if @form == :categorize
+
+        # filing options
+        _div.doctype do
+          _label do
             _input type: 'radio', name: 'doctype', value: 'icla',
               onClick: -> {@form = ICLA}
+            _span 'icla'
           end
 
-          _td do
-            _input type: 'radio', name: 'doctype', value: 'grant',
-              onClick: -> {@form = Grant}
-          end
-
-          _td do
+          _label do
             _input type: 'radio', name: 'doctype', value: 'ccla',
               onClick: -> {@form = CCLA}
+            _span 'ccla'
           end
 
-          _td do
-            _input type: 'radio', name: 'doctype', value: 'nda',
-              onClick: -> {@form = NDA}
+          _label do
+            _input type: 'radio', name: 'doctype', value: 'grant',
+              onClick: -> {@form = Grant}
+            _span 'software grant'
           end
 
-          _td do
+          _label do
             _input type: 'radio', name: 'doctype', value: 'mem',
               onClick: -> {@form = MemApp}
+            _span 'membership application'
+          end
+
+          _hr
+
+          _label do
+            _input type: 'radio', name: 'doctype', value: 'incomplete',
+              onClick: -> {@form = Incomplete}
+            _span 'incomplete form'
+          end
+
+          _label do
+            _input type: 'radio', name: 'doctype', value: 'unsigned',
+              onClick: -> {@form = Unsigned}
+            _span 'unsigned form'
+          end
+
+          _label do
+            _input type: 'radio', name: 'doctype', value: 'pubkey',
+              onClick: -> {@form = Unsigned}
+            _span 'upload public key'
           end
         end
 
-        _tr do
-          _td 'icla'
-          _td 'grant'
-          _td 'ccla'
-          _td 'nda'
-          _td 'mem'
+      elsif @form == :edit
+
+        _ul do
+          _li "\u2704 burst", onMouseDown: self.burst
+          _li.divider
+          _li "\u21B7 right", onMouseDown: self.rotate_attachment
+          _li "\u21c5 flip", onMouseDown: self.rotate_attachment
+              _li "\u21B6 left", onMouseDown: self.rotate_attachment
+          _li.divider
+          _li "\u2716 delete", onMouseDown: self.delete_attachment
         end
-      end
 
-      if @form
+      else
+
         React.createElement @form, headers: @@headers, submit: self.submit
+
       end
     end
   end
 
   ########################################################################
+  #                            Tab selection                             #
+  ########################################################################
+
+  def tabSelect(event)
+    @form = event.currentTarget.textContent.downcase()
+    jQuery('.doctype input').prop('checked', false)
+  end
+
+  ########################################################################
   #                           React lifecycle                            #
   ########################################################################
 
@@ -288,7 +331,7 @@ class Parts < React
   def selectPart(part)
     if @selected != part
       @selected = part
-      @form = nil
+      @form = :categorize
 
       Array(document.querySelectorAll('input[type=radio]')).each do |button|
         button.checked = false

-- 
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.

[whimsy] 01/05: update react

Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

commit 33de297bb19595e3735c7eeb097a2fccdf7e3d33
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sun Sep 4 15:13:34 2016 -0400

    update react
---
 www/secmail/public/assets/react-min.js | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/www/secmail/public/assets/react-min.js b/www/secmail/public/assets/react-min.js
index 52dce07..5658bf5 100644
--- a/www/secmail/public/assets/react-min.js
+++ b/www/secmail/public/assets/react-min.js
@@ -1,5 +1,5 @@
 /**
- * React (with addons) v0.14.3
+ * React (with addons) v0.14.6
  *
  * Copyright 2013-2015, Facebook, Inc.
  * All rights reserved.
@@ -9,8 +9,8 @@
  * of patent rights can be found in the PATENTS file in the same directory.
  *
  */
-!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.React=e()}}(function(){return function e(t,n,r){function o(i,u){if(!n[i]){if(!t[i]){var s="function"==typeof require&&require;if(!u&&s)return s(i,!0);if(a)return a(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.cod [...]
-topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown [...]
-text:"text",tspan:"tspan"},r);t.exports=i},{164:164,55:55,56:56}],44:[function(e,t,n){"use strict";var r={useCreateElement:!1};t.exports=r},{}],45:[function(e,t,n){"use strict";var r=e(9),o=e(11),a=e(70),i=e(76),u=e(158),s={dangerouslySetInnerHTML:"`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.",style:"`style` must be set using `updateStylesByID()`."},l={updatePropertyByID:function(e,t,n){var r=a.getNode(e);s.hasOwnProperty(t)?u(!1):void 0,null!=n?o.setValueForPrope [...]
-"use strict";var r={};t.exports=r},{}],79:[function(e,t,n){"use strict";var r=e(162),o=r({prop:null,context:null,childContext:null});t.exports=o},{162:162}],80:[function(e,t,n){"use strict";function r(e){function t(t,n,r,o,a,i){if(o=o||_,i=i||r,null==n[r]){var u=C[a];return t?new Error("Required "+u+" `"+i+"` was not specified in "+("`"+o+"`.")):null}return e(n,r,o,a,i)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function o(e){function t(t,n,r,o,a){var i=t[n],u=v(i);if(u! [...]
-pageX:function(e){return"pageX"in e?e.pageX:e.clientX+a.currentScrollLeft},pageY:function(e){return"pageY"in e?e.pageY:e.clientY+a.currentScrollTop}};o.augmentClass(r,u),t.exports=r},{108:108,111:111,124:124}],107:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(108),a=e(124),i={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:a};o.augmentClass(r,i),t.exports=r},{108:108,124:124}],108:[f [...]
\ No newline at end of file
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.React=e()}}(function(){return function e(t,n,r){function o(i,u){if(!n[i]){if(!t[i]){var s="function"==typeof require&&require;if(!u&&s)return s(i,!0);if(a)return a(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.cod [...]
+topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOve [...]
+56:56}],44:[function(e,t,n){"use strict";var r={useCreateElement:!1};t.exports=r},{}],45:[function(e,t,n){"use strict";var r=e(9),o=e(11),a=e(70),i=e(76),u=e(158),s={dangerouslySetInnerHTML:"`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.",style:"`style` must be set using `updateStylesByID()`."},l={updatePropertyByID:function(e,t,n){var r=a.getNode(e);s.hasOwnProperty(t)?u(!1):void 0,null!=n?o.setValueForProperty(r,t,n):o.deleteValueForProperty(r,t)},dangerouslyRepla [...]
+t.exports=r},{}],79:[function(e,t,n){"use strict";var r=e(162),o=r({prop:null,context:null,childContext:null});t.exports=o},{162:162}],80:[function(e,t,n){"use strict";function r(e){function t(t,n,r,o,a,i){if(o=o||_,i=i||r,null==n[r]){var u=C[a];return t?new Error("Required "+u+" `"+i+"` was not specified in "+("`"+o+"`.")):null}return e(n,r,o,a,i)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function o(e){function t(t,n,r,o,a){var i=t[n],u=v(i);if(u!==e){var s=C[o],l=m(i) [...]
+},pageY:function(e){return"pageY"in e?e.pageY:e.clientY+a.currentScrollTop}};o.augmentClass(r,u),t.exports=r},{108:108,111:111,124:124}],107:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(108),a=e(124),i={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:a};o.augmentClass(r,i),t.exports=r},{108:108,124:124}],108:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var  [...]
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.

[whimsy] 04/05: cleanup edit part

Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

commit 50bdce0e5f04028b91fea223ab72ee9be2c12687
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Tue Sep 6 12:09:13 2016 -0400

    cleanup edit part
---
 www/secmail/public/secmail.css | 16 +++++++++++++---
 www/secmail/views/parts.js.rb  |  8 ++++----
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/www/secmail/public/secmail.css b/www/secmail/public/secmail.css
index 18dcb5a..b861779 100644
--- a/www/secmail/public/secmail.css
+++ b/www/secmail/public/secmail.css
@@ -96,13 +96,23 @@ ul.contextMenu {
   padding: 8px 0;
 }
 
+ul#editPart {
+  padding: 0 1.5em;
+}
+
 .contextMenu li {
   list-style: none;
-  padding: 0px 8px;
-  margin: 0px;
+  padding: 0 8px;
+  margin: 0;
+}
+
+#editPart li {
+  list-style: none;
+  padding: 8;
+  margin: 16px 0;
 }
 
-.contextMenu li:hover {
+.contextMenu li:hover, #editPart li:hover {
   background-color: #1E90FF;
   color: white;
   cursor: pointer;
diff --git a/www/secmail/views/parts.js.rb b/www/secmail/views/parts.js.rb
index 2782fc6..340cd78 100644
--- a/www/secmail/views/parts.js.rb
+++ b/www/secmail/views/parts.js.rb
@@ -127,7 +127,7 @@ class Parts < React
 
       elsif @form == :edit
 
-        _ul do
+        _ul.editPart! do
           _li "\u2704 burst", onMouseDown: self.burst
           _li.divider
           _li "\u21B7 right", onMouseDown: self.rotate_attachment
@@ -231,7 +231,7 @@ class Parts < React
   # burst a PDF into individual pages
   def burst(event)
     data = {
-      selected: @menu,
+      selected: @menu || @selected,
       message: window.parent.location.pathname
     }
 
@@ -250,7 +250,7 @@ class Parts < React
   # burst a PDF into individual pages
   def delete_attachment(event)
     data = {
-      selected: @menu,
+      selected: @menu || @selected,
       message: window.parent.location.pathname
     }
 
@@ -274,7 +274,7 @@ class Parts < React
     message = window.parent.location.pathname
 
     data = {
-      selected: @menu,
+      selected: @menu || @selected,
       message: message,
       direction: event.currentTarget.textContent
     }

-- 
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.

[whimsy] 05/05: screen dangerous content

Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

commit a8473106466bf6ffdad38a58129b6037c03b969e
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Tue Sep 6 12:50:44 2016 -0400

    screen dangerous content
---
 www/secmail/server.rb            | 11 +++++++++++
 www/secmail/views/danger.html.rb | 21 +++++++++++++++++++++
 www/secmail/views/parts.js.rb    |  8 +++++++-
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/www/secmail/server.rb b/www/secmail/server.rb
index 3e22214..5d4ddcf 100644
--- a/www/secmail/server.rb
+++ b/www/secmail/server.rb
@@ -130,6 +130,17 @@ get %r{^/(\d{6})/(\w+)/_raw_$} do |month, hash|
   [200, {'Content-Type' => 'text/plain'}, message.raw]
 end
 
+# intercede for potentially dangerous message attachments
+get %r{^/(\d{6})/(\w+)/_danger_/(.*?)$} do |month, hash, name|
+  message = Mailbox.new(month).find(hash)
+  pass unless message
+
+  @part = message.find(name)
+  pass unless @part
+
+  _html :danger
+end
+
 # a specific attachment for a message
 get %r{^/(\d{6})/(\w+)/(.*?)$} do |month, hash, name|
   message = Mailbox.new(month).find(hash)
diff --git a/www/secmail/views/danger.html.rb b/www/secmail/views/danger.html.rb
new file mode 100644
index 0000000..3d6006d
--- /dev/null
+++ b/www/secmail/views/danger.html.rb
@@ -0,0 +1,21 @@
+_html do
+  _h1.bg_danger 'Potentially Dangerous Content'
+
+  _table.table.table_bordered do
+    _tbody do
+      @part.headers.each do |name, value|
+        next if name == :mime
+        _tr do
+          _td name.to_s
+          if name == :name
+            _td do
+              _a value, href: "../#{value}"
+            end
+          else
+            _td value
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/www/secmail/views/parts.js.rb b/www/secmail/views/parts.js.rb
index 340cd78..ba69a77 100644
--- a/www/secmail/views/parts.js.rb
+++ b/www/secmail/views/parts.js.rb
@@ -46,8 +46,14 @@ class Parts < React
         options[:className] = nil
       end
 
+      if attachment =~ /\.(pdf|txt|jpeg|jpg|gif|png)$/
+        link = attachment
+      else
+        link = "_danger_/#{attachment}"
+      end
+
       _li options do
-        _a attachment, href: attachment, target: 'content', draggable: 'false'
+        _a attachment, href: link, target: 'content', draggable: 'false'
       end
     end
 

-- 
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.

[whimsy] 02/05: timestamp css file

Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

commit 18b685f74be4caba9f97abd661643af0eb49a05d
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sun Sep 4 15:14:31 2016 -0400

    timestamp css file
---
 www/secmail/server.rb           | 2 ++
 www/secmail/views/index.html.rb | 2 +-
 www/secmail/views/parts.html.rb | 3 ++-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/www/secmail/server.rb b/www/secmail/server.rb
index 198c5a4..4dbec18 100644
--- a/www/secmail/server.rb
+++ b/www/secmail/server.rb
@@ -19,6 +19,7 @@ get '/' do
   # determine latest month for which there are messages
   archives = Dir["#{ARCHIVE}/*.yml"].select {|name| name =~ %r{/\d{6}\.yml$}}
   @mbox = archives.empty? ? nil : File.basename(archives.sort.last, '.yml')
+  @cssmtime = File.mtime('public/secmail.css').to_i
   _html :index
 end
 
@@ -91,6 +92,7 @@ get %r{^/(\d{6})/(\w+)/_index_$} do |month, hash|
   @attachments = message.attachments
   @headers = message.headers.dup
   @headers.delete :attachments
+  @cssmtime = File.mtime('public/secmail.css').to_i
   _html :parts
 end
 
diff --git a/www/secmail/views/index.html.rb b/www/secmail/views/index.html.rb
index 51ecb2f..f2cfc9d 100644
--- a/www/secmail/views/index.html.rb
+++ b/www/secmail/views/index.html.rb
@@ -1,5 +1,5 @@
 _html do
-  _link rel: 'stylesheet', type: 'text/css', href: 'secmail.css'
+  _link rel: 'stylesheet', type: 'text/css', href: "secmail.css?#{@cssmtime}"
 
   _div.index!
 
diff --git a/www/secmail/views/parts.html.rb b/www/secmail/views/parts.html.rb
index 47379bf..60c7551 100644
--- a/www/secmail/views/parts.html.rb
+++ b/www/secmail/views/parts.html.rb
@@ -3,7 +3,8 @@
 #
 
 _html do
-  _link rel: 'stylesheet', type: 'text/css', href: '../../secmail.css'
+  _link rel: 'stylesheet', type: 'text/css', 
+    href: "../../secmail.css?#{@cssmtime}"
 
   _ul_ do
     _li! {_a 'text', href: '_body_', target: 'content'}

-- 
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.