Skip to content

Commit

Permalink
Updated site. Updated httplib to 0.18.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
pigpigyyy committed Dec 4, 2024
1 parent 1f3ad76 commit 3d4206b
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 63 deletions.
12 changes: 6 additions & 6 deletions Docs/i18n/zh-Hans/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
"description": "The feature title one in front page"
},
"feature_description_one": {
"message": "Dora SSR 的理念:开发游戏是一种更有深度地玩游戏的方式。",
"message": "开发游戏是一种更有深度地玩游戏的方式。",
"description": "The feature description one in front page"
},
"feature_title_two": {
"message": "不限设备,不限场地",
"message": "不限设备,或场地",
"description": "The feature title two in front page"
},
"feature_description_two": {
"message": "Dora SSR 的目标:在任何电子设备上极速提供开箱即用的游戏开发环境。",
"message": "在任何电子设备上极速提供开箱即用的游戏开发环境。",
"description": "The feature description two in front page"
},
"feature_title_three": {
"message": "编程游乐场",
"description": "The feature title three in front page"
},
"feature_description_three": {
"message": "Dora SSR 提供多元的编程语言支持,满足你多样的编程口味!",
"message": "提供多元的编程语言支持,满足你多样的编程口味!",
"description": "The feature description three in front page"
},
"theme.ErrorPageContent.title": {
Expand Down Expand Up @@ -446,11 +446,11 @@
"description": "The engine feature description Rust Scripting Support in front page"
},
"promotion_section_title": {
"message": "为什么选择 Dora SSR",
"message": "为什么选择 Dora",
"description": "The promotion section title in front page"
},
"feature_section_title": {
"message": "部分引擎功能特性",
"message": "部分引擎功能",
"description": "The feature section title in front page"
},
"engine_feature_title_cross_platform_game_dev_support": {
Expand Down
64 changes: 36 additions & 28 deletions Docs/src/components/HomepageFeatures/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import clsx from 'clsx';
import styles from './styles.module.css';
import Translate from '@docusaurus/Translate';

const pix_dora = require('@site/static/img/pix-dora.png');
const pix_toto = require('@site/static/img/pix-toto.png');

const feature_img_one = require('@site/static/img/1.png');
const feature_img_two = require('@site/static/img/2.png');
const feature_img_three = require('@site/static/img/3.png');
Expand All @@ -15,23 +18,6 @@ type FeatureItem = {
};

const PromotionFeatureList: FeatureItem[] = [
{
title: (
<Translate
id="feature_title_one"
description='The feature title one in front page'>
Play as You Create
</Translate>
),
image: <img src={feature_img_one.default} alt='feature_title_one' className={styles.featureImg}/>,
description: (
<Translate
id="feature_description_one"
description='The feature description one in front page'>
What Dora SSR is for: Making Game Development a New Gaming.
</Translate>
),
},
{
title: (
<Translate
Expand Down Expand Up @@ -60,21 +46,40 @@ const PromotionFeatureList: FeatureItem[] = [
<Translate
id='feature_description_three'
description='The feature description three in front page'>
Satisfy your coding cravings with Dora SSR's versatile language support!
Satisfy your coding cravings with versatile language support!
</Translate>
),
},
{
title: (
<Translate
id="feature_title_one"
description='The feature title one in front page'>
Play as You Create
</Translate>
),
image: <img src={feature_img_one.default} alt='feature_title_one' className={styles.featureImg}/>,
description: (
<Translate
id="feature_description_one"
description='The feature description one in front page'>
Making Game Development a New Gaming.
</Translate>
),
},
];

function PromotionFeature({title, Svg, image, description}: FeatureItem) {
return (
<div className={clsx('col col--4')}>
<div className="text--center">
{Svg ? <Svg className={styles.featureImg} role="img"/> : image}
</div>
<div className="text--center padding-horiz--md">
<h3>{title}</h3>
<p>{description}</p>
<div className={clsx('col col--4 padding-bottom--md')}>
<div className={styles.promotionFeature}>
<div className="text--center padding-top--sm padding-bottom--sm">
{Svg ? <Svg className={styles.featureImg} role="img"/> : image}
</div>
<div className={clsx('text--left', styles.cardText)}>
<h3>{title}</h3>
<p>{description}</p>
</div>
</div>
</div>
);
Expand Down Expand Up @@ -169,8 +174,8 @@ const EngineFeatureList: FeatureItem[] = [
{
title: (
<Translate
id='engine_feature_platformer_game_support'
description='The engine feature title Platformer Game Support in front page'>
id='engine_feature_platformer_game_support'
description='The engine feature title Platformer Game Support in front page'>
Platformer Game Support
</Translate>
),
Expand Down Expand Up @@ -363,8 +368,10 @@ export default function HomepageFeatures(): JSX.Element {
<Translate
id='promotion_section_title'
description='The promotion section title in front page'>
Why Dora SSR
Why Dora
</Translate>
<img src={pix_dora.default} alt='pix_dora' className={styles.pixImg}/>
SSR
</h2>
<div className="row">
{PromotionFeatureList.map((props, idx) => (
Expand All @@ -374,6 +381,7 @@ export default function HomepageFeatures(): JSX.Element {
</div>
<div className={styles.featureSection}>
<h2 className="text--center">
<img src={pix_toto.default} alt='pix_toto' className={styles.pixImg}/>
<Translate
id='feature_section_title'
description='The feature section title in front page'>
Expand Down
40 changes: 36 additions & 4 deletions Docs/src/components/HomepageFeatures/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,41 @@
--feature-card-description-color: var(--feature-card-description-color-dark);
}

.promotionFeature {
display: flex;
flex-direction: row;
border: 2px solid #f9d86d; /* 黄色边框 */
border-radius: 15px;
box-shadow: 0 4px 8px var(--feature-card-shadow);
width: 100%;
height: 100%;
padding-right: 1rem;
}

.cardText {
width: 100%;
padding-top: 2rem;
}

.cardText h3 {
color: var(--ifm-color-primary);
font-size: 20px;
margin-bottom: 5px;
}

.cardText p {
font-size: 14px;
line-height: 1.6;
}

.features {
padding: 4rem 0;
padding: 4rem 0 0 0;
}

.featureCard {
background-color: var(--feature-card-bg);
border-radius: 8px;
border: 1px solid var(--feature-card-shadow);
box-shadow: 0 2px 4px var(--feature-card-shadow);
padding: 1.5rem;
transition: transform 0.2s ease-in-out;
Expand All @@ -45,8 +73,8 @@
}

.featureImg {
height: 90%;
width: 90%;
width: 100%;
height: auto;
max-width: 500px;
}

Expand Down Expand Up @@ -74,7 +102,7 @@
.featureSection {
margin-bottom: 2rem;
padding-bottom: 2rem;
border-bottom: 1px solid #eaeaea;
border-bottom: 1px solid var(--feature-card-shadow);
}

.featureSection:last-of-type {
Expand All @@ -84,3 +112,7 @@
.featureSection h2 {
margin-bottom: 1.5rem;
}

.pixImg {
width: 40px;
}
5 changes: 3 additions & 2 deletions Docs/src/pages/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@
.heroTitle {
font-size: 5rem;
color: var(--ifm-color-title);
padding-bottom: 1rem;
}

.heroSubtitle {
padding-bottom: 1rem;
padding-bottom: 2rem;
color: var(--ifm-color-subtitle);
}

@media screen and (max-width: 996px) {
.heroBanner {
padding: 2rem;
padding: 2rem 0;
}
}

Expand Down
3 changes: 1 addition & 2 deletions Docs/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function HomepageHeader() {
<p className={clsx('hero__subtitle', styles.heroSubtitle)}>The <strong>Dora</strong> game engine, <strong>S</strong>pecial <strong>S</strong>uper <strong>R</strong>are edition.</p>
<div className={styles.buttons}>
<Link
className="button button--secondary button--lg"
className="button button--primary button--lg"
to="/docs/tutorial/quick-start">
<Translate
id='dora_enter_tutorial_button'
Expand All @@ -33,7 +33,6 @@ function HomepageHeader() {
}

export default function Home(): JSX.Element {
const {siteConfig} = useDocusaurusContext();
return (
<Layout
description="Description will go into a meta tag in <head />">
Expand Down
Binary file added Docs/static/img/pix-dora.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Docs/static/img/pix-toto.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 34 additions & 21 deletions Source/3rdParty/httplib/httplib.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifndef CPPHTTPLIB_HTTPLIB_H
#define CPPHTTPLIB_HTTPLIB_H

#define CPPHTTPLIB_VERSION "0.18.1"
#define CPPHTTPLIB_VERSION "0.18.3"

/*
* Configuration
Expand Down Expand Up @@ -613,6 +613,7 @@ using Ranges = std::vector<Range>;
struct Request {
std::string method;
std::string path;
Params params;
Headers headers;
std::string body;

Expand All @@ -624,7 +625,6 @@ struct Request {
// for server
std::string version;
std::string target;
Params params;
MultipartFormDataMap files;
Ranges ranges;
Match matches;
Expand Down Expand Up @@ -2275,7 +2275,7 @@ inline std::wstring u8string_to_wstring(const char *s) {
wlen = ::MultiByteToWideChar(
CP_UTF8, 0, s, len,
const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(ws.data())), wlen);
if (wlen != ws.size()) { ws.clear(); }
if (wlen != static_cast<int>(ws.size())) { ws.clear(); }
}
return ws;
}
Expand Down Expand Up @@ -7432,9 +7432,13 @@ inline bool ClientImpl::send(Request &req, Response &res, Error &error) {

#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
inline bool ClientImpl::is_ssl_peer_could_be_closed(SSL *ssl) const {
detail::set_nonblocking(socket_.sock, true);
auto se = detail::scope_exit(
[&]() { detail::set_nonblocking(socket_.sock, false); });

char buf[1];
return !SSL_peek(ssl, buf, 1) &&
SSL_get_error(ssl, 0) == SSL_ERROR_ZERO_RETURN;
SSL_get_error(ssl, 0) == SSL_ERROR_ZERO_RETURN;
}
#endif

Expand All @@ -7452,9 +7456,7 @@ inline bool ClientImpl::send_(Request &req, Response &res, Error &error) {

#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
if (is_alive && is_ssl()) {
if (is_ssl_peer_could_be_closed(socket_.ssl)) {
is_alive = false;
}
if (is_ssl_peer_could_be_closed(socket_.ssl)) { is_alive = false; }
}
#endif

Expand Down Expand Up @@ -7813,7 +7815,13 @@ inline bool ClientImpl::write_request(Stream &strm, Request &req,
{
detail::BufferStream bstrm;

const auto &path = url_encode_ ? detail::encode_url(req.path) : req.path;
const auto &path_with_query =
req.params.empty() ? req.path
: append_query_params(req.path, req.params);

const auto &path =
url_encode_ ? detail::encode_url(path_with_query) : path_with_query;

detail::write_request_line(bstrm, req.method, path);

header_writer_(bstrm, req.headers);
Expand Down Expand Up @@ -7972,7 +7980,9 @@ inline bool ClientImpl::process_request(Stream &strm, Request &req,
// Body
if ((res.status != StatusCode::NoContent_204) && req.method != "HEAD" &&
req.method != "CONNECT") {
auto redirect = 300 < res.status && res.status < 400 && follow_location_;
auto redirect = 300 < res.status && res.status < 400 &&
res.status != StatusCode::NotModified_304 &&
follow_location_;

if (req.response_handler && !redirect) {
if (!req.response_handler(res)) {
Expand All @@ -7993,9 +8003,7 @@ inline bool ClientImpl::process_request(Stream &strm, Request &req,
: static_cast<ContentReceiverWithProgress>(
[&](const char *buf, size_t n, uint64_t /*off*/,
uint64_t /*len*/) {
if (res.body.size() + n > res.body.max_size()) {
return false;
}
assert(res.body.size() + n <= res.body.max_size());
res.body.append(buf, n);
return true;
});
Expand All @@ -8009,18 +8017,23 @@ inline bool ClientImpl::process_request(Stream &strm, Request &req,

if (res.has_header("Content-Length")) {
if (!req.content_receiver) {
auto len = std::min<size_t>(res.get_header_value_u64("Content-Length"),
res.body.max_size());
if (len > 0) { res.body.reserve(len); }
auto len = res.get_header_value_u64("Content-Length");
if (len > res.body.max_size()) {
error = Error::Read;
return false;
}
res.body.reserve(static_cast<size_t>(len));
}
}

int dummy_status;
if (!detail::read_content(strm, res, (std::numeric_limits<size_t>::max)(),
dummy_status, std::move(progress), std::move(out),
decompress_)) {
if (error != Error::Canceled) { error = Error::Read; }
return false;
if (res.status != StatusCode::NotModified_304) {
int dummy_status;
if (!detail::read_content(strm, res, (std::numeric_limits<size_t>::max)(),
dummy_status, std::move(progress),
std::move(out), decompress_)) {
if (error != Error::Canceled) { error = Error::Read; }
return false;
}
}
}

Expand Down

0 comments on commit 3d4206b

Please sign in to comment.