Skip to content

Commit

Permalink
Merge pull request #554 from TaYaKi71751/dev-fix-default-tag-on-web
Browse files Browse the repository at this point in the history
Fix of #550
  • Loading branch information
violet-dev authored Oct 6, 2024
2 parents 01ef6ce + 650c1e2 commit 60d756a
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 1 deletion.
1 change: 1 addition & 0 deletions violet/assets/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
"maindownload": "Download",
"usewebsearch": "Search on Web",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"usevioletserver": "Use Violet Server",
"wouldyouupdate": "Would you update?",
"violetservermsg": "Would you like to enable the Violet Server function? This function is a service that collects user behavior information and displays statistical information in real time. We do not collect any information that could identify you.",
Expand Down
1 change: 1 addition & 0 deletions violet/assets/locale/eo.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
"maindownload": "Donwload",
"usewebsearch": "Buscar en la Web",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"usevioletserver": "Usar servidor violet",
"wouldyouupdate": "¿Actualizarías?",
"violetservermsg": "¿Le gustaría habilitar la función Violet Server? Esta función es un servicio que recopila información sobre el comportamiento del usuario y muestra información estadística en tiempo real. No recopilamos ninguna información que pueda identificarlo.",
Expand Down
1 change: 1 addition & 0 deletions violet/assets/locale/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
"maindownload": "Download",
"usewebsearch": "Cerca Sul Web",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"usevioletserver": "Usa Violet Server",
"wouldyouupdate": "Aggiorneresti?",
"violetservermsg": "Vuoi abilitare la funzione Violet Server? Questa funzione è un servizio che raccoglie informazioni sul comportamento dell'utente e visualizza informazioni statistiche in tempo reale. Non raccogliamo alcuna informazione che possa identificarti.",
Expand Down
1 change: 1 addition & 0 deletions violet/assets/locale/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
"maindownload": "ダウンロード数",
"usewebsearch": "ウェブで検索する",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"usevioletserver": "Violet サーバーを使用する",
"wouldyouupdate": "更新しますか?",
"violetservermsg": "Violet サーバーの機能を有効にしますか?この機能は、ユーザーの行動情報を収集し、リアルタイムで統計情報を表示するサービスです。ユーザーを特定することができる情報は収集しません。",
Expand Down
1 change: 1 addition & 0 deletions violet/assets/locale/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
"maindownload": "다운로드 수",
"usewebsearch": "웹에서 검색하기",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"usevioletserver": "바이올렛 서버 사용하기",
"wouldyouupdate": "업데이트할까요? (업데이트가 제대로 진행되지 않는다면, 설정->수동 업데이트를 통해 업데이트 해주세요!)",
"violetservermsg": "Violet Server 기능을 활성화하시겠습니까? 이 기능은 사용자 행동 정보을 수집하여 실시간으로 통계 정보를 보여주는 서비스입니다. 사용자를 특정할 수 있는 정보는 수집하지 않습니다.",
Expand Down
1 change: 1 addition & 0 deletions violet/assets/locale/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
"maindownload": "Download",
"usewebsearch": "Pesquisar na Web",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"usevioletserver": "Usar servido do Violet",
"wouldyouupdate": "Você atualizaria?",
"violetservermsg": "Deseja habilitar o servidor do Violet? Esta função é um serviço que coleta informações de comportamento do usuário e exibe informações estatísticas em tempo real. Não coletamos nenhuma informação que possa identificá-lo.",
Expand Down
1 change: 1 addition & 0 deletions violet/assets/locale/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
"maindownload": "Download",
"usewebsearch": "Search on Web",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"usevioletserver": "Use Violet Server",
"wouldyouupdate": "Would you update?",
"violetservermsg": "Would you like to enable the Violet Server function? This function is a service that collects user behavior information and displays statistical information in real time. We do not collect any information that could identify you.",
Expand Down
1 change: 1 addition & 0 deletions violet/assets/locale/zh_Hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
"maindownload": "下载",
"usewebsearch": "在网路上搜寻",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"usevioletserver": "使用紫罗兰色服务器",
"wouldyouupdate": "你会更新吗?",
"violetservermsg": "您要启用Violet服务器功能吗? 此功能是一项收集用户行为信息并实时显示统计信息的服务。 我们不会收集任何可以识别您身份的信息。",
Expand Down
1 change: 1 addition & 0 deletions violet/assets/locale/zh_Hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
"maindownload": "Download",
"usewebsearch": "Search on Web",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"usevioletserver": "Use Violet Server",
"wouldyouupdate": "Would you update?",
"violetservermsg": "Would you like to enable the Violet Server function? This function is a service that collects user behavior information and displays statistical information in real time. We do not collect any information that could identify you.",
Expand Down
3 changes: 2 additions & 1 deletion violet/lib/component/hentai.dart
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,8 @@ class HentaiManager {

static Future<List<QueryResult>> searchEHentai(String what,
[int next = 0, bool exh = false]) async {
final search = Uri.encodeComponent(what);
final search = Uri.encodeComponent(
Settings.includeTagNetwork ? '${Settings.includeTags} ${what}' : what);
final url =
'https://e${exh ? 'x' : '-'}hentai.org/?${next == 0 ? '' : 'next=$next&'}f_cats=${Settings.searchCategory}&f_search=$search&advsearch=1&f_sname=on&f_stags=on${Settings.searchExpunged ? '&f_sh=on' : ''}&f_spf=&f_spt=';

Expand Down
31 changes: 31 additions & 0 deletions violet/lib/pages/settings/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,37 @@ class _SettingsPageState extends State<SettingsPage>
});
},
),
if (Settings.searchNetwork)
InkWell(
customBorder: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(8.0),
bottomRight: Radius.circular(8.0))),
child: ListTile(
leading: Icon(
MdiIcons.searchWeb,
color: Settings.majorColor,
),
title: Text(Translations.instance!.trans('includetagnetwork')),
trailing: Switch(
value: Settings.includeTagNetwork,
onChanged: (newValue) async {
await Settings.setIncludeTagOnWeb(newValue);
setState(() {
_shouldReload = true;
});
},
activeTrackColor: Settings.majorColor,
activeColor: Settings.majorAccentColor,
),
),
onTap: () async {
await Settings.setIncludeTagOnWeb(!Settings.includeTagNetwork);
setState(() {
_shouldReload = true;
});
},
),
if (Settings.searchNetwork)
InkWell(
customBorder: const RoundedRectangleBorder(
Expand Down
8 changes: 8 additions & 0 deletions violet/lib/settings/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Settings {
static late List<String> routingRule; // image routing rule
static late List<String> searchRule;
static late bool searchNetwork;
static late bool includeTagNetwork;
static late bool searchExpunged;
static late int searchCategory;

Expand Down Expand Up @@ -198,6 +199,7 @@ class Settings {
(await _getString('searchrule', 'Hitomi|EHentai|ExHentai|NHentai'))
.split('|');
searchNetwork = await _getBool('searchnetwork');
includeTagNetwork = await _getBool('includetagnetwork');
searchExpunged = await _getBool('searchexpunged');
searchCategory = await _getInt('searchcategory', 993);

Expand Down Expand Up @@ -687,6 +689,12 @@ class Settings {
await prefs.setBool('searchnetwork', nn);
}

static Future<void> setIncludeTagOnWeb(bool nn) async {
includeTagNetwork = nn;

await prefs.setBool('includetagnetwork', nn);
}

static Future<void> setSearchExpunged(bool nn) async {
searchExpunged = nn;

Expand Down

0 comments on commit 60d756a

Please sign in to comment.