Giter VIP home page Giter VIP logo

rust_lang_cn's Introduction

rust_lang_cn

China Community for Rust lang

如何运行

如果要在本地搭建Rust China测试环境,请参见以下步骤:

  1. clone本仓库到本地
  2. 初始化MySQL数据库,创建rust_lang_cn数据库,创建各数据表,建表语句见tables.sql
  3. 拷贝config-sample.toml至config.toml,修改其中的数据库配置
  4. 拷贝log4rs-sample.yaml至log4rs.yaml,可以不用修改
  5. 编译,执行命令cargo build --release
  6. 运行./target/release/rust_lang_cn
  7. 访问http://localhost:3000

如何修改css

  • css采用sass来编写,产生好的css文件在static中:static/css/base.css
  • sass源码在src/sass中,主文件为src/sass/base.scss,其中集成了Bootstrap的sass源码,修改或添加样式只要修改src/sass/base.scss,然后用sass编译输出到static/css/base.css,具体命令如下:

你可以手动编译

cd src/sass
sass base.scss ../../static/css/base.css

使用 gulp 监听自动编译

npm i
gulp

目前已有功能

  • 注册
  • 登录
  • 发表话题
  • 编辑话题
  • 回帖
  • 个人中心
  • RSS
  • 置顶,加精

如何参与

常见问题

  • mac上编译找不到openssl,参见这个issue

License: MIT

rust_lang_cn's People

Contributors

liyuan462 avatar messense avatar miyogurt avatar sallon88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rust_lang_cn's Issues

Build failed on nightly rust

😍  rust_lang_cn git:(master) ✗ cargo build --verbose
error: unable to get packages from source

Caused by:
  failed to parse manifest at `/Users/messense/.cargo/registry/src/github.com-1ecc6299db9ec823/iron-0.3.0/Cargo.toml`

Caused by:
  you have already provided an operation, such as =, ~, or ^; only use one
😍  rust_lang_cn git:(master) ✗ rustc --version
rustc 1.12.0-nightly (576f76659 2016-08-09)
😍  rust_lang_cn git:(master) ✗ cargo --version
cargo 0.13.0-nightly (c205132 2016-08-09)

看起来是 iron 0.3.0 的锅

访问登录页报错

版本:rust 1.18.0
命令:RUST_BACKTRACE=1 ./target/debug/rust_lang_cn
出错页面:http://localhost:3000/user/login

2017-06-22T16:07:12.495476+00:00 DEBUG hyper::server - Incoming stream
2017-06-22T16:07:12.495911+00:00 DEBUG hyper::server::request - Request Line: Get AbsolutePath("/user/login") Http11
2017-06-22T16:07:12.495964+00:00 DEBUG hyper::server::request - Headers { Host: localhost:3000
, Connection: keep-alive
, Cache-Control: max-age=0
, Upgrade-Insecure-Requests: 1
, User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
, Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
, Referer: http://localhost:3000/
, Accept-Encoding: gzip, deflate, sdch, br
, Accept-Language: zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4
, }
thread '<unnamed>' panicked at 'assertion failed: `(left == right)` (left: `-186318615`, right: `1`)', /Users/nswbmw/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.7.14/src/crypto/hmac.rs:100
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: std::panicking::begin_panic_fmt
   6: openssl::crypto::hmac::HMAC::init_once
   7: openssl::crypto::hmac::HMAC::new
   8: cookie::jar::secure::dosign
   9: cookie::jar::secure::sign
  10: cookie::jar::CookieJar::signed::sign
  11: cookie::jar::CookieJar::add
  12: <oven::OvenAfter as iron::middleware::AfterMiddleware>::after
  13: <alloc::boxed::Box<iron::middleware::AfterMiddleware + 'static> as iron::middleware::AfterMiddleware>::after
  14: iron::middleware::Chain::continue_from_after
  15: iron::middleware::Chain::continue_from_handler
  16: iron::middleware::Chain::continue_from_before
  17: <iron::middleware::Chain as iron::middleware::Handler>::handle
  18: <alloc::boxed::Box<iron::middleware::Handler + 'static> as iron::middleware::Handler>::handle
  19: iron::middleware::Chain::continue_from_handler
  20: iron::middleware::Chain::continue_from_before
  21: <iron::middleware::Chain as iron::middleware::Handler>::handle
  22: <alloc::boxed::Box<iron::middleware::Handler + 'static> as iron::middleware::Handler>::handle
  23: <mount::mount::Mount as iron::middleware::Handler>::handle
  24: <iron::iron::Iron<H> as hyper::server::Handler>::handle
  25: <hyper::server::Worker<H>>::keep_alive_loop
  26: <hyper::server::Worker<H>>::handle_connection
  27: hyper::server::handle::{{closure}}
  28: hyper::server::listener::spawn_with::{{closure}}
  29: <std::panic::AssertUnwindSafe<F> as core::ops::FnOnce<()>>::call_once
  30: std::panicking::try::do_call
  31: __rust_maybe_catch_panic
  32: std::panicking::try
  33: std::panic::catch_unwind
  34: std::thread::Builder::spawn::{{closure}}
  35: <F as alloc::boxed::FnBox<A>>::call_box
  36: std::sys::imp::thread::Thread::new::thread_start
  37: _pthread_body
  38: _pthread_start
2017-06-22T16:07:12.534896+00:00 DEBUG hyper::server::response - writing head: Http11 InternalServerError
2017-06-22T16:07:12.535165+00:00 DEBUG hyper::server::response - headers [
Headers { Date: Thu, 22 Jun 2017 16:07:12 GMT
, Transfer-Encoding: chunked
, }]
2017-06-22T16:07:12.535348+00:00 DEBUG hyper::server::response - drop successful

希望能够增加 License

最近有些希望使用 Rust 编写网站程序,如果可以的话,希望能够基于本项目的基础开始。
但是因为本项目没有指明具体的协议,不能贸然作出决定。
希望能为本项目添加适当的开源协议。非常感谢!

增加表情支持

最好数据库编码支持这样的👿 emoji 表情。
外置一些这样的表情,就更棒了!!
image

请添加github帐号登录功能.

@liyuan462
你好, 现在各种社区非常多, 如果为每一个社区去注册一个帐号, 那么将有很多帐号需要记忆, 我觉得ruby china 以及 gitter.im 的登录模式就非常的不错, 使用github的帐号登录.

重置密码

忘记密码后通过验证过的 EMail 重新设置密码。

CSRF 和一些其他安全问题

POC

访问后会发现你的 http://rust-lang-cn.org/ 被 lougout 了,实际上还可以用来进行发帖回帖之类的操作。
修复方案可以是检查 Referer 或者加 CSRF Token。

另外还有一些其他的小问题:

  1. 固定的logined cookie(其实是iron-login的问题),实际上可以加一个nonce避免每次的MAC都一样。handlers/user.rs#L600
  2. 非常数时间的密码比较,可以用 constant_time_eqhandlers/user.rs#L626
  3. 过弱的password hash,建议使用 argon2handlers/user.rs#L81

cargo build --release

➜  rust_lang_cn cargo build --release
   Compiling kernel32-sys v0.2.1
   Compiling toml v0.1.28
   Compiling conduit-mime-types v0.7.3
   Compiling unicode-bidi v0.2.3
   Compiling num v0.1.31
   Compiling uuid v0.1.18
   Compiling unicase v1.4.0
   Compiling openssl-sys-extras v0.7.9
Build failed, waiting for other jobs to finish...
error: failed to run custom build command for `openssl-sys-extras v0.7.9`
Process didn't exit successfully: `/Users/julaud/www/rust/rust_lang_cn/target/release/build/openssl-sys-extras-358c9a6ad3e03664/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("x86_64-apple-darwin")
OPT_LEVEL = Some("3")
PROFILE = Some("release")
TARGET = Some("x86_64-apple-darwin")
debug=false opt-level=3
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-m64" "-fPIC" "-o" "/Users/julaud/www/rust/rust_lang_cn/target/release/build/openssl-sys-extras-358c9a6ad3e03664/out/src/openssl_shim.o" "-c" "src/openssl_shim.c"
ExitStatus(ExitStatus(256))


command did not execute successfully, got: exit code: 1



--- stderr
src/openssl_shim.c:1:10: fatal error: 'openssl/hmac.h' file not found
#include <openssl/hmac.h>
         ^
1 error generated.
thread '<main>' panicked at 'explicit panic', /Users/julaud/.cargo/registry/src/github.com-88ac128001ac3a9a/gcc-0.3.26/src/lib.rs:818
note: Run with `RUST_BACKTRACE=1` for a backtrace.

登录会话问题

场景:
1、起初未登录 rust 论坛,打开论坛的几个页面
2、新开标签页登录 rust 论坛
3、刷新未登录前打开的页面,页面还是未登录

可能就是一个简单的会话问题,我看下能不能有时间改下

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.