Skip to content

Commit

Permalink
Root: Support machi.to URL without subdomain (#1245)
Browse files Browse the repository at this point in the history
まちBBSのURLのうち地方名サブドメインが付いてないURLをまちBBSとして
扱うように修正します。まちBBSのURLは地方名サブドメインが付いてる
タイプとサブドメインが無いタイプの2種類あります。

修正前は地方名サブドメインが付いてないURLを登録して開くと
HTTPリダイレクトが発生して読み込みに失敗していました。

例
- `https://tokyo.machi.to/tokyo/`
- `https://machi.to/tokyo/`

参考文献
https://www.machi.to/bbs/read.cgi/tawara/1416672649/65
  • Loading branch information
ma8ma committed Sep 9, 2023
1 parent d86261e commit e919a8e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/dbtree/root.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1593,11 +1593,10 @@ bool Root::is_JBBS( const std::string& url )
//
bool Root::is_machi( const std::string& url )
{
const std::string hostname = MISC::get_hostname( url );

if( hostname.find( ".machi.to" ) != std::string::npos ) return true;
constexpr bool protocol = false;
const std::string hostname = MISC::get_hostname( url, protocol );

return false;
return MISC::ends_with( hostname, "machi.to" );
}


Expand Down

0 comments on commit e919a8e

Please sign in to comment.