diff --git a/distribution/src/main/resources/gettoken.py b/distribution/src/main/resources/gettoken.py deleted file mode 100644 index c1b46754..00000000 --- a/distribution/src/main/resources/gettoken.py +++ /dev/null @@ -1,53 +0,0 @@ -# -- coding: utf-8 -- - -import time -import hashlib -import random -import requests - - - -# 签名方法说明 -# 注册用户需要签名,需要在header中加入nonce,timestamp, sign。 -# 值如下所示。 -# 服务器会检查时间戳,2个小时内有效。注意测试使用时避免过期 -# 请注意需要与wildfirechat.conf中的SECRET_KEY保持一致 - -#需要用到requests库,首先要安装pip -#sudo easy_install pip - -#然后在安装requests module -#sudo pip install requests - -import sys - -if len(sys.argv) < 2: - print 'Usage: python gettoken.py userid' - sys.exit() - -user = sys.argv[1] - -SECRET_KEY = '123456' -URL = 'http://localhost:18080/admin/user/token' - -ts = (int(round(time.time() * 1000))) -random.seed(time.time()) -nonce = (int(round(random.random() * 100000))) -orignSign = bytes(nonce) + '|' + SECRET_KEY + '|' + bytes(ts) -sign = hashlib.sha1(orignSign).hexdigest() - -headers = {'nonce': bytes(nonce), 'timestamp':bytes(ts), 'sign':sign, 'Content-Type':'application/json'} - -payload = {'userId':user} - -print 'headers:' -print headers -print -print 'payload:' -print payload -print - -r = requests.post(URL, headers = headers, json = payload) -print 'response:' -print(r.status_code) -print r.content diff --git a/distribution/src/main/resources/getuserinfo.py b/distribution/src/main/resources/getuserinfo.py deleted file mode 100644 index 928a6503..00000000 --- a/distribution/src/main/resources/getuserinfo.py +++ /dev/null @@ -1,53 +0,0 @@ -# -- coding: utf-8 -- - -import time -import hashlib -import random -import requests - - - -# 签名方法说明 -# 注册用户需要签名,需要在header中加入nonce,timestamp, sign。 -# 值如下所示。 -# 服务器会检查时间戳,2个小时内有效。注意测试使用时避免过期 -# 请注意需要与wildfirechat.conf中的SECRET_KEY保持一致 - -#需要用到requests库,首先要安装pip -#sudo easy_install pip - -#然后在安装requests module -#sudo pip install requests - -import sys - -if len(sys.argv) < 2: - print 'Usage: python getuserinfo.py userid' - sys.exit() - -user = sys.argv[1] - -SECRET_KEY = '123456' -URL = 'http://localhost/admin/user/info' - -ts = (int(round(time.time() * 1000))) -random.seed(time.time()) -nonce = (int(round(random.random() * 100000))) -orignSign = bytes(nonce) + '|' + SECRET_KEY + '|' + bytes(ts) -sign = hashlib.sha1(orignSign).hexdigest() - -headers = {'nonce': bytes(nonce), 'timestamp':bytes(ts), 'sign':sign, 'Content-Type':'application/json'} - -payload = {'userId':user} - -print 'headers:' -print headers -print -print 'payload:' -print payload -print - -r = requests.post(URL, headers = headers, json = payload) -print 'response:' -print(r.status_code) -print r.content diff --git a/distribution/src/main/resources/register.py b/distribution/src/main/resources/register.py deleted file mode 100644 index 138de33d..00000000 --- a/distribution/src/main/resources/register.py +++ /dev/null @@ -1,55 +0,0 @@ -# -- coding: utf-8 -- - -import time -import hashlib -import random -import requests - - - -# 签名方法说明 -# 注册用户需要签名,需要在header中加入nonce,timestamp, sign。 -# 值如下所示。 -# 服务器会检查时间戳,2个小时内有效。注意测试使用时避免过期 -# 请注意需要与wildfirechat.conf中的SECRET_KEY保持一致 - -#需要用到requests库,首先要安装pip -#sudo easy_install pip - -#然后在安装requests module -#sudo pip install requests - -import sys - -if len(sys.argv) < 4: - print 'Usage: python register.py username password displayname' - sys.exit() - -user = sys.argv[1] -pwd = sys.argv[2] -displayname = sys.argv[3] - -SECRET_KEY = '123456' -URL = 'http://localhost:18080/admin/user/create' - -ts = (int(round(time.time() * 1000))) -random.seed(time.time()) -nonce = (int(round(random.random() * 100000))) -orignSign = bytes(nonce) + '|' + SECRET_KEY + '|' + bytes(ts) -sign = hashlib.sha1(orignSign).hexdigest() - -headers = {'nonce': bytes(nonce), 'timestamp':bytes(ts), 'sign':sign, 'Content-Type':'application/json'} - -payload = {'name':user, 'password':pwd, 'displayName':displayname} - -print 'headers:' -print headers -print -print 'payload:' -print payload -print - -r = requests.post(URL, headers = headers, json = payload) -print 'response:' -print(r.status_code) -print r.content diff --git a/protobuf/pbmessage/build.sh b/protobuf/pbmessage/build.sh deleted file mode 100755 index 2eedd477..00000000 --- a/protobuf/pbmessage/build.sh +++ /dev/null @@ -1,8 +0,0 @@ -protoc -odata.pb wfcmessage.proto -g++ -o convert convert.cpp -./convert -mv pbdata.h ../../../proto/mars/proto/src/Proto/ -rm convert data.pb -protoc --java_out=./ wfcmessage.proto -mv ./cn/wildfirechat/proto/WFCMessage.java ../../client/src/main/java/cn/wildfirechat/proto/ -rm -rf ./cn/wildfirechat/proto diff --git a/protobuf/pbmessage/convert.cpp b/protobuf/pbmessage/convert.cpp deleted file mode 100644 index 2b23c716..00000000 --- a/protobuf/pbmessage/convert.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include - -using namespace std; -int main () { - ofstream out("pbdata.h"); - ifstream in("data.pb", ios::in | ios::binary); - if (out.is_open() && in.is_open()) - { - - out << "static unsigned char pbdata[] = { "; - - int flag = 0; - int preCh; - while (!in.eof()) { - unsigned char ch = 0; - in.read((char *)&ch, 1); - - if (flag == 1) { - out << preCh; - } else if (flag > 1) { - out << ","; - out << preCh; - } - preCh = ch; - - flag += 1; - } - - out << "};\n"; - - in.close(); - out.close(); - } - return 0; -} diff --git a/protobuf/pbmessage/wfcmessage.proto b/protobuf/pbmessage/wfcmessage.proto deleted file mode 100644 index fc43cb86..00000000 --- a/protobuf/pbmessage/wfcmessage.proto +++ /dev/null @@ -1,446 +0,0 @@ -syntax = "proto2"; -//package mars.stn; - - -option java_package = "cn.wildfirechat.proto"; -option java_outer_classname = "WFCMessage"; -//option optimize_for = LITE_RUNTIME; - - -message AddFriendRequest { - required string target_uid = 1; - required string reason = 2; -} - -message Conversation { - required int32 type = 1; - required string target = 2; - required int32 line = 3; -} - -message GroupInfo { - optional string target_id = 1; - required string name = 2; - optional string portrait = 3; - optional string owner = 4; - required int32 type = 5; - optional int32 member_count = 6; - optional string extra = 7; - optional int64 update_dt = 8; - optional int64 member_update_dt = 9; -} - - -message GroupMember { - required string member_id = 1; - optional string alias = 2; - required int32 type = 3; - optional int64 update_dt = 4; -} - -message Group { - required GroupInfo group_info = 1; - repeated GroupMember members = 2; -} - -message ChannelInfo { - optional string target_id = 1; - required string name = 2; - optional string portrait = 3; - optional string owner = 4; - //0, public; 1, private; 2 closed; - optional int32 status = 5; - optional string desc = 6; - optional string extra = 7; - optional int64 update_dt = 8; - optional string secret = 9; - optional string callback = 10; - optional int32 automatic = 11; -} - -message ModifyChannelInfo { - required string channel_id = 1; - required int32 type = 2; - required string value = 3; -} - -message TransferChannel { - required string channel_id = 1; - required string new_owner = 2; -} - -message PullChannelInfo { - required string channel_id = 1; - required int64 head = 2; -} - -message PullChannelListener { - required string channel_id = 1; - required int32 offset = 2; - required int32 count = 3; -} - -message PullChannelListenerResult { - required int32 total_count = 1; - required int32 offset = 2; - repeated string listener = 3; -} - -message ListenChannel { - required string channel_id = 1; - required int32 listen = 2; -} - -message SearchChannelResult { - repeated ChannelInfo channel = 1; - required string keyword = 2; -} - -message MessageContent { - required int32 type = 1; - optional string searchable_content = 2; - optional string push_content = 3; - optional string content = 4; - optional bytes data = 5; - optional int32 mediaType = 6; - optional string remoteMediaUrl = 7; - optional int32 persist_flag= 8; - optional int32 expire_duration= 9; - optional int32 mentioned_type= 10; - repeated string mentioned_target= 11; -} - -message AddGroupMemberRequest { - required string group_id = 1; - repeated GroupMember added_member = 2; - repeated int32 to_line = 3; - optional MessageContent notify_content = 4; -} - -message CreateGroupRequest { - required Group group = 1; - repeated int32 to_line = 2; - optional MessageContent notify_content = 3; -} - -message DismissGroupRequest { - required string group_id = 1; - repeated int32 to_line = 2; - optional MessageContent notify_content = 3; -} - -message FriendRequest { - optional string from_uid = 1; - required string to_uid = 2; - required string reason = 3; - optional int32 status = 4; - optional int64 update_dt = 5; - optional bool from_read_status = 6; - optional bool to_read_status = 7; -} - -message GeneralResult { - required int32 error_code = 1; -} - -message GetUploadTokenResult { - required string domain = 1; - required string token = 2; - required string server = 3; - optional int32 port = 4; -} - -message HandleFriendRequest { - required string target_uid = 1; - required int32 status = 2; -} - -message IDBuf { - required string id = 1; -} - -message IDListBuf { - repeated string id = 1; -} - -message Message { - required Conversation conversation = 1; - required string from_user = 2; - required MessageContent content = 3; - optional int64 message_id = 4; - optional int64 server_timestamp = 5; - //not use anymore - optional string to_user = 6; - repeated string to = 7; -} - -message User { - required string uid = 1; - optional string name = 2; - optional string display_name = 3; - optional string portrait = 4; - optional string mobile = 5; - optional string email = 6; - optional string address = 7; - optional string company = 8; - optional string extra = 9; - optional int64 update_dt = 10; - optional int32 gender = 11; - optional string social = 12; - //0 normal user; 1 robot - optional int32 type = 13; -} - -message Robot { - required string uid = 1; - //0 normal; 1 deleted; - required int32 state = 2; - optional string owner = 3; - optional string secret = 4; - optional string callback = 5; - optional string extra = 6; -} - -message GetRobotsResult { - repeated Robot entry = 1; -} - -message Thing { - required string uid = 1; - //0 normal; 1 deleted; - required int32 state = 2; - required string token = 3; - optional string owner = 4; - optional string extra = 5; -} - -message GetThingsResult { - repeated Thing entry = 1; -} - -message UploadDeviceTokenRequest { - required int32 platform = 1; - required string app_name = 2; - required string device_token = 3; - required int32 push_type = 4; -} - -message ModifyGroupInfoRequest { - required string group_id = 1; - required int32 type = 2; - required string value = 3; - repeated int32 to_line = 4; - optional MessageContent notify_content = 5; -} - -message InfoEntry { - required int32 type = 1; - required string value = 2; -} - -message ModifyMyInfoRequest { - repeated InfoEntry entry = 1; -} - -message NotifyMessage { - required int32 type = 1; - required int64 head = 2; - optional string target = 3; -} - -message PullMessageRequest { - required int64 id = 1; - required int32 type = 2; - optional int64 delay = 3; -} - -message PullMessageResult { - repeated Message message = 1; - required int64 current = 2; - required int64 head = 3; -} - -message PullGroupInfoResult { - repeated GroupInfo info = 1; -} - -message PullGroupMemberRequest { - required string target = 1; - required int64 head = 2; -} - -message PullGroupMemberResult { - repeated GroupMember member = 1; -} - -message UserRequest { - required string uid = 1; - optional int64 update_dt = 2; -} - -message PullUserRequest { - repeated UserRequest request = 1; -} - -message UserResult { - required User user = 1; - required int32 code = 2; -} - - -message PullUserResult { - repeated UserResult result = 1; -} - -message QuitGroupRequest { - required string group_id = 1; - repeated int32 to_line = 2; - optional MessageContent notify_content = 3; -} - -message RemoveGroupMemberRequest { - required string group_id = 1; - repeated string removed_member = 2; - repeated int32 to_line = 3; - optional MessageContent notify_content = 4; -} - -message TransferGroupRequest { - required string group_id = 1; - required string new_owner = 2; - repeated int32 to_line = 3; - optional MessageContent notify_content = 4; -} - -message ModifyGroupMemberAlias { - required string group_id = 1; - required string alias = 2; - repeated int32 to_line = 3; - optional MessageContent notify_content = 4; -} - -message UserSettingEntry { - required int32 scope = 1; - required string key = 2; - required string value = 3; - required int64 update_dt = 4; -} - -message ModifyUserSettingReq { - required int32 scope = 1; - required string key = 2; - required string value = 3; -} - -message Version { - required int64 version = 1; -} - -message GetUserSettingResult { - repeated UserSettingEntry entry = 1; -} - -message Friend { - required string uid = 1; - required int32 state = 2; - required int64 update_dt = 3; -} - -message GetFriendsResult { - repeated Friend entry = 1; -} - -message GetFriendRequestResult { - repeated FriendRequest entry = 1; -} - -message ConnectAckPayload { - optional int64 msg_head = 1; - optional int64 friend_head = 2; - optional int64 friend_rq_head = 3; - optional int64 setting_head = 4; - optional string node_addr = 5; - optional int32 node_port = 6; - optional int64 server_time = 7; -} - -message IMHttpWrapper { - required string token = 1; - required string client_id = 2; - required string request = 3; - optional bytes data = 4; -} - -message SearchUserRequest { - required string keyword = 1; - optional int32 fuzzy = 2; - optional int32 page = 3; -} - -message SearchUserResult { - repeated User entry = 1; -} - -message GetChatroomInfoRequest { - required string chatroom_id = 1; - optional int64 update_dt = 2; -} - -message ChatroomInfo { - required string title = 1; - optional string desc = 2; - optional string portrait = 3; - optional int32 member_count = 4; - optional int64 create_dt = 5; - optional int64 update_dt = 6; - optional string extra = 7; - optional int32 state = 8; -} - -message GetChatroomMemberInfoRequest { - required string chatroom_id = 1; - optional int32 max_count = 2; -} - -message ChatroomMemberInfo { - optional int32 member_count = 1; - repeated string members = 2; -} - -message INT64Buf { - required int64 id = 1; -} - -message NotifyRecallMessage { - required int64 id = 1; - required string from_user = 2; -} - -message BlackUserRequest { - required string uid = 1; - required int32 status = 2; -} - -message RouteRequest { - optional string app = 1; - optional int32 platform = 2; - optional int32 push_type = 3; - optional string device_name = 4; - optional string device_version = 5; - optional string phone_name = 6; - optional string language = 7; - optional string carrier_name = 8; - optional string app_version = 9; - optional string sdk_version = 10; -} - -message RouteResponse { - required string host = 1; - required int32 long_port = 2; - required int32 short_port = 3; -} - -message GetTokenRequest { - required string user_id = 1; - required string client_id = 2; -} diff --git a/release.sh b/release.sh deleted file mode 100755 index abb43da0..00000000 --- a/release.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -dest=$1 -mvn clean install -Dmaven.test.skip=true -if [ -n "$dest" ];then -scp distribution/target/distribution-0.10-bundle-tar.tar.gz ${dest}:~/wildfirechat/ -ssh ${dest} 'cd ~/wildfirechat; bash deploy.sh' - -sleep 20s -curl im.liyufan.win:8080/api/version - -echo "" -echo "curl wildfirechat.cn/api/version" -fi