Permalink
Browse files

Merge branch 'master' of github.com:iZRIdJJ53S/syaberi-house

Conflicts:
	app.js
  • Loading branch information...
2 parents 8a92179 + 8994976 commit 9fe1ad70a4369e11b4e51659c030174f3bc18324 @nsyee nsyee committed Nov 7, 2012
Showing with 144 additions and 1 deletion.
  1. +1 −0 app.js
  2. +61 −0 certs/dev.crt
  3. +11 −0 certs/dev.csr
  4. +15 −0 certs/dev.key
  5. +6 −0 public/js/templates/chat.js
  6. +36 −0 public/js/util.js
  7. +14 −1 public/js/views/chat.js
View
@@ -95,6 +95,7 @@ app.configure(function() {
// ルーティングの機能を提供する。これはExpressでの拡張
app.use(express.compress());
app.use(express.csrf());
+ app.use(express.csrf()); // この位置じゃないと動かない?順番要注意
app.use(express.static(path.join(__dirname, 'public')));
app.use(app.router);
app.use(middleware.notFound);
View
@@ -0,0 +1,61 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number:
+ bd:b8:79:a4:64:ba:e0:40
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd, CN=127.0.0.1
+ Validity
+ Not Before: Nov 7 05:48:11 2012 GMT
+ Not After : Nov 7 05:48:11 2013 GMT
+ Subject: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd, CN=127.0.0.1
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public Key: (1024 bit)
+ Modulus (1024 bit):
+ 00:a1:0b:ea:d5:65:70:6f:90:42:7c:2d:64:41:c5:
+ 83:9e:37:d9:6f:f2:e4:94:e2:cd:d7:fb:ce:9a:fe:
+ d0:05:3f:c8:40:fa:93:21:9f:89:a5:36:8d:58:b2:
+ ec:96:a6:98:d4:50:b9:86:08:f7:1f:10:7f:71:5d:
+ f1:e4:07:66:bd:c4:2a:f3:81:fa:d7:f4:47:40:03:
+ 17:4f:ee:39:4b:ae:9f:e1:7b:4d:6d:36:ea:00:b5:
+ 0f:23:90:90:ba:45:74:4a:c9:d0:36:61:21:b2:be:
+ 8d:79:7c:3c:6b:42:3f:c9:32:2d:db:dd:4f:6a:23:
+ c8:6e:ac:aa:47:35:d1:2c:d9
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Basic Constraints:
+ CA:FALSE
+ Netscape Comment:
+ OpenSSL Generated Certificate
+ X509v3 Subject Key Identifier:
+ FD:33:5D:EB:E5:9B:89:B5:8E:8E:8A:F1:DA:01:49:15:ED:9C:62:C9
+ X509v3 Authority Key Identifier:
+ keyid:97:3B:92:BE:2B:98:29:B3:58:39:70:C1:B3:4C:62:7D:A3:09:D8:B2
+
+ Signature Algorithm: sha1WithRSAEncryption
+ 92:f9:f5:52:35:36:37:3b:10:75:c3:99:d0:42:2d:fa:88:4a:
+ 77:8a:54:51:79:54:c3:fd:46:7a:4b:46:3a:2e:ff:bd:06:c1:
+ 64:2b:ef:4b:20:72:09:cb:85:bb:47:1b:f7:6e:e7:76:8b:58:
+ 33:a3:38:e6:22:c0:8e:29:0a:9b:bb:89:a5:3c:26:6a:42:f7:
+ c8:bc:81:56:4e:f5:9b:9d:7b:07:1a:2d:52:c3:08:48:a0:28:
+ 80:86:28:24:46:45:40:a9:6e:54:2b:58:d7:be:3f:17:f1:a1:
+ d2:54:f8:e3:a3:8d:d1:c8:4b:09:4b:01:22:c1:33:e2:9b:7e:
+ 66:28
+-----BEGIN CERTIFICATE-----
+MIICqzCCAhSgAwIBAgIJAL24eaRkuuBAMA0GCSqGSIb3DQEBBQUAMFkxCzAJBgNV
+BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX
+aWRnaXRzIFB0eSBMdGQxEjAQBgNVBAMTCTEyNy4wLjAuMTAeFw0xMjExMDcwNTQ4
+MTFaFw0xMzExMDcwNTQ4MTFaMFkxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpTb21l
+LVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0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XCuAfx2oiFpCqfHqbwPQ==
+-----END RSA PRIVATE KEY-----
@@ -11,6 +11,9 @@
'</div>'+
'<div class="owner-titlebox">'+
'<p class="owner-title">{{{message}}}</p>'+
+ '{{#if extImageUrl}}'+
+ '<img src="{{extImageUrl}}" class="owner-img">'+
+ '{{/if}}'+
'<div class="owner-username"><a href="/users/{{userId}}">by.{{userName}}</a></div>'+
'<div class="owner-date">{{time}} [1]'+
'{{#if isHis}}'+
@@ -28,6 +31,9 @@
'</div>'+
'<div class="member-titlebox">'+
'<p class="member-title">{{{message}}}</p>'+
+ '{{#if extImageUrl}}'+
+ '<img src="{{extImageUrl}}" class="member-img">'+
+ '{{/if}}'+
'<div class="member-username"><a href="/users/{{userId}}">by.{{userName}}</a></div>'+
'<div class="member-date">{{time}} [2]'+
'{{#if isHis}}'+
View
@@ -28,6 +28,42 @@
var newdate = year+"-"+month+"-"+day+"T"+hour+":"+minute+":"+second+"Z";
return newdate;
+ },
+ // URLかどうかの判定
+ isUrl: function(text) {
+ if (text.length == 0) {
+ return false;
+ }
+ text.match(/(http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.\/?%&=:;_]*)?)/);
+
+ if (RegExp.$1 != null && RegExp.$1.length > 0) {
+ return true;
+ }
+ return false;
+ },
+ // URLの取得
+ getUrl: function(text) {
+ if (text.length == 0) {
+ return false;
+ }
+ text.match(/(http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.\/?%&=:;_]*)?)/);
+
+ if (RegExp.$1 != null && RegExp.$1.length > 0) {
+ return RegExp.$1;
+ }
+ return false;
+ },
+ // 画像URLの判定
+ isImageUrl: function(url) {
+ if (url.length == 0) {
+ return false;
+ }
+ url.match(/(\.(jpg|jpeg|gif|png)$)/i);
+
+ if (RegExp.$1 != null && RegExp.$1.length > 0) {
+ return true;
+ }
+ return false;
}
};
@@ -150,8 +150,21 @@
isOwner: userId === ownerId,
isHis: userId === data.userId, //本人の書き込みを表すフラグ
isInvite: status !== 2,
- isUrlOpen: isUrlOpen
+ isUrlOpen: isUrlOpen,
+ extImageUrl: ''
};
+
+ // urlの判断
+ if (syaberi.util.isUrl(data.message)) {
+ var tmp_url = syaberi.util.getUrl(data.message);
+
+ // 画像urlの判断
+ if (syaberi.util.isImageUrl(tmp_url)) {
+ // 画像urlで値を上書き
+ params.extImageUrl = tmp_url;
+ }
+ }
+
//オーナーのフキダシは向きを変える
if (ownerId === data.userId) {
chatTemplate = syaberi.templates.chat.chatL(params);

0 comments on commit 9fe1ad7

Please sign in to comment.