Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Use Excluded Tags On Web #569

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions violet/assets/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"usewebsearch": "Search on Web",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"excludetagnetwork": "Use Excluded 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 @@ -193,6 +193,7 @@
"usewebsearch": "Buscar en la Web",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"excludetagnetwork": "Use Excluded 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 @@ -193,6 +193,7 @@
"usewebsearch": "Cerca Sul Web",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"excludetagnetwork": "Use Excluded 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 @@ -193,6 +193,7 @@
"usewebsearch": "ウェブで検索する",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"excludetagnetwork": "Use Excluded 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 @@ -193,6 +193,7 @@
"usewebsearch": "웹에서 검색하기",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"excludetagnetwork": "Use Excluded 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 @@ -193,6 +193,7 @@
"usewebsearch": "Pesquisar na Web",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"excludetagnetwork": "Use Excluded 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 @@ -193,6 +193,7 @@
"usewebsearch": "Search on Web",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"excludetagnetwork": "Use Excluded 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 @@ -193,6 +193,7 @@
"usewebsearch": "在网路上搜寻",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"excludetagnetwork": "Use Excluded 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 @@ -193,6 +193,7 @@
"usewebsearch": "Search on Web",
"usesearchexpunged": "Search for Expunged",
"includetagnetwork": "Use Default Tag on Web",
"excludetagnetwork": "Use Excluded 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
2 changes: 1 addition & 1 deletion violet/lib/component/hentai.dart
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ class HentaiManager {
static Future<List<QueryResult>> searchEHentai(String what,
[int next = 0, bool exh = false]) async {
final search = Uri.encodeComponent(
Settings.includeTagNetwork ? '${Settings.includeTags} ${what}' : what);
'${Settings.includeTagNetwork ? '${Settings.includeTags} ' : ''}$what${Settings.excludeTagNetwork ? ' ${Settings.excludeTags.where((e) => e.trim() != '').map((e) => '-$e').join(' ').trim()}' : ''}');
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 @@ -806,6 +806,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('excludetagnetwork')),
trailing: Switch(
value: Settings.excludeTagNetwork,
onChanged: (newValue) async {
await Settings.setExcludeTagOnWeb(newValue);
setState(() {
_shouldReload = true;
});
},
activeTrackColor: Settings.majorColor,
activeColor: Settings.majorAccentColor,
),
),
onTap: () async {
await Settings.setExcludeTagOnWeb(!Settings.excludeTagNetwork);
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 @@ -52,6 +52,7 @@ class Settings {
static late List<String> searchRule;
static late bool searchNetwork;
static late bool includeTagNetwork;
static late bool excludeTagNetwork;
static late bool searchExpunged;
static late int searchCategory;

Expand Down Expand Up @@ -200,6 +201,7 @@ class Settings {
.split('|');
searchNetwork = await _getBool('searchnetwork');
includeTagNetwork = await _getBool('includetagnetwork');
excludeTagNetwork = await _getBool('excludetagnetwork');
searchExpunged = await _getBool('searchexpunged');
searchCategory = await _getInt('searchcategory', 993);

Expand Down Expand Up @@ -703,6 +705,12 @@ class Settings {
await prefs.setBool('includetagnetwork', nn);
}

static Future<void> setExcludeTagOnWeb(bool nn) async {
excludeTagNetwork = nn;

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

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

Expand Down
Loading