diff --git a/chat/CharacterSearch.vue b/chat/CharacterSearch.vue index 92523ff..cd328ac 100644 --- a/chat/CharacterSearch.vue +++ b/chat/CharacterSearch.vue @@ -229,7 +229,23 @@ updateSearch(data?: SearchData): void { if (data) { - this.data = data; + // this.data = {kinks: [], genders: [], orientations: [], languages: [], furryprefs: [], roles: [], positions: []}; + // this.data = data; + + this.data = _.mapValues( + data, + (category, categoryName) => ( + _.map( + category, + (selection) => { + const jsonSelection = JSON.stringify(selection); + const v = _.find((this.options as any)[categoryName], (op) => (JSON.stringify(op) === jsonSelection)); + + return v || selection; + } + ) + ) + ) as SearchData; } } diff --git a/chat/ConversationView.vue b/chat/ConversationView.vue index 106685d..86c51f0 100644 --- a/chat/ConversationView.vue +++ b/chat/ConversationView.vue @@ -184,7 +184,7 @@ import {BBCodeView} from '../bbcode/view'; import {isShowing as anyDialogsShown} from '../components/Modal.vue'; import {Keys} from '../keys'; - import AdView from './ads/AdView.vue'; + import CharacterAdView from './character/CharacterAdView.vue'; import {Editor} from './bbcode'; import CommandHelp from './CommandHelp.vue'; import { characterImage, getByteLength, getKey } from './common'; @@ -199,7 +199,7 @@ import ReportDialog from './ReportDialog.vue'; import {isCommand} from './slash_commands'; import UserView from './UserView.vue'; - import UserChannelList from './UserChannelList.vue'; + import CharacterChannelList from './character/CharacterChannelList.vue'; import * as _ from 'lodash'; import Dropdown from '../components/Dropdown.vue'; @@ -208,7 +208,7 @@ components: { user: UserView, 'bbcode-editor': Editor, 'manage-channel': ManageChannel, settings: ConversationSettings, logs: Logs, 'message-view': MessageView, bbcode: BBCodeView(core.bbCodeParser), 'command-help': CommandHelp, - 'ad-view': AdView, 'channel-list': UserChannelList, dropdown: Dropdown, adSettings: ConversationAdSettings + 'ad-view': CharacterAdView, 'channel-list': CharacterChannelList, dropdown: Dropdown, adSettings: ConversationAdSettings } }) export default class ConversationView extends Vue { @@ -481,11 +481,11 @@ } showAds(): void { - (<AdView>this.$refs['adViewer']).show(); + (<CharacterAdView>this.$refs['adViewer']).show(); } showChannels(): void { - (<UserChannelList>this.$refs['channelList']).show(); + (<CharacterChannelList>this.$refs['channelList']).show(); } diff --git a/chat/UserMenu.vue b/chat/UserMenu.vue index 1367bd2..9f65c4f 100644 --- a/chat/UserMenu.vue +++ b/chat/UserMenu.vue @@ -48,7 +48,7 @@ import Vue from 'vue'; import {BBCodeView} from '../bbcode/view'; import Modal from '../components/Modal.vue'; - import AdView from './ads/AdView.vue'; + import CharacterAdView from './character/CharacterAdView.vue'; import {characterImage, errorToString, getByteLength, profileLink} from './common'; import core from './core'; import {Channel, Character} from './interfaces'; @@ -56,7 +56,7 @@ import ReportDialog from './ReportDialog.vue'; @Component({ - components: {bbcode: BBCodeView(core.bbCodeParser), modal: Modal, 'ad-view': AdView} + components: {bbcode: BBCodeView(core.bbCodeParser), modal: Modal, 'ad-view': CharacterAdView} }) export default class UserMenu extends Vue { @Prop({required: true}) @@ -131,7 +131,7 @@ return; } - (<AdView>this.$refs['adViewDialog']).show(); + (<CharacterAdView>this.$refs['adViewDialog']).show(); } diff --git a/chat/character/CharacterAdView.vue b/chat/character/CharacterAdView.vue index 0caa3a8..662b545 100644 --- a/chat/character/CharacterAdView.vue +++ b/chat/character/CharacterAdView.vue @@ -14,7 +14,7 @@ </div> <div class="row ad-viewer" ref="pageBody" v-else> - <i>Character has not posted any ads.</i> + <i><user :character="character">{{character.name}}</user> has not posted any ads on the channels you are on.</i> </div> </modal> @@ -37,7 +37,7 @@ import { BBCodeView } from '../../bbcode/view'; @Component({ components: {modal: Modal, user: UserView, bbcode: BBCodeView(core.bbCodeParser)} }) -export default class AdView extends CustomDialog { +export default class CharacterAdView extends CustomDialog { @Prop({required: true}) readonly character!: Character; diff --git a/chat/character/CharacterChannelList.vue b/chat/character/CharacterChannelList.vue index d0c2ea6..bae3fac 100644 --- a/chat/character/CharacterChannelList.vue +++ b/chat/character/CharacterChannelList.vue @@ -4,12 +4,16 @@ Channels for <user :character="character">{{character.name}}</user> </template> - <div class="user-channel-list" ref="pageBody"> + <div class="user-channel-list" ref="pageBody" v-if="channels.length > 0"> <template v-for="channel in channels"> <h3><a href="#" @click.prevent="jumpToChannel(channel)">#{{channel.name}}</a></h3> </template> </div> + <div class="user-channel-list" ref="pageBody" v-else> + <i><user :character="character">{{character.name}}</user> is not on any of the channels you are on.</i> + </div> + </modal> </template> @@ -18,18 +22,18 @@ import * as _ from 'lodash'; import { Component, Hook, Prop, Watch } from '@f-list/vue-ts'; -import CustomDialog from '../components/custom_dialog'; -import Modal from '../components/Modal.vue'; -import { Character } from '../fchat/interfaces'; -import core from './core'; -import { Conversation } from './interfaces'; -import UserView from './UserView.vue'; +import CustomDialog from '../../components/custom_dialog'; +import Modal from '../../components/Modal.vue'; +import { Character } from '../../fchat/interfaces'; +import core from '../core'; +import { Conversation } from '../interfaces'; +import UserView from '../UserView.vue'; import ChannelConversation = Conversation.ChannelConversation; @Component({ components: {modal: Modal, user: UserView} }) -export default class UserChannelList extends CustomDialog { +export default class CharacterChannelList extends CustomDialog { @Prop({required: true}) readonly character!: Character; @@ -73,4 +77,4 @@ export default class UserChannelList extends CustomDialog { .user-channel-list h3 { font-size: 120%; } -</style> \ No newline at end of file +</style> diff --git a/chat/preview/ImagePreview.vue b/chat/preview/ImagePreview.vue index 8a192b5..cf8b6a5 100644 --- a/chat/preview/ImagePreview.vue +++ b/chat/preview/ImagePreview.vue @@ -401,6 +401,7 @@ this.interval = null; this.visible = true; this.visibleSince = Date.now(); + this.shouldDismiss = false; this.initialCursorPosition = screen.getCursorScreenPoint(); diff --git a/chat/preview/test-urls.txt b/chat/preview/test-urls.txt index 94c4539..4100b97 100644 --- a/chat/preview/test-urls.txt +++ b/chat/preview/test-urls.txt @@ -72,3 +72,7 @@ https://www.youtube.com/watch?v=fk6JtDhA7WI (audio on, video doesn't show, audio Slow https://giphy.com/gifs/arianagrande-ariana-grande-thank-u-next-you-uldtLAK6tSOKP5PWw3 http://gfycatporn.com/deepthroat.php + + +Derpibooru +Pornhub GIFS diff --git a/electron/language.ts b/electron/language.ts index 546793d..0b2f4d9 100644 --- a/electron/language.ts +++ b/electron/language.ts @@ -2,7 +2,26 @@ import * as _ from 'lodash'; export function getSafeLanguages(langs: string | string[] | undefined): string[] { - return langs ? _.castArray(langs) : []; + const initialLanguages = _.isString(langs) + ? ([langs.replace('_', '-')]) + : (langs || []); + + const initialCount = initialLanguages.length; + const safeLanguages = _.filter(initialLanguages, (il) => (_.indexOf(supportedLanguages, il) >= 0)); + + if ((initialCount > 0) && (safeLanguages.length)) { + safeLanguages.push('en-GB'); + } + + return safeLanguages; +} + + +let supportedLanguages: string[] = []; + + +export function updateSupportedLanguages(langs: string[]): void { + supportedLanguages = langs; } @@ -30,7 +49,6 @@ export const knownLanguageNames = { et: 'Estonian', fa: 'Persian', - fi: 'Finnish', fo: 'Faroese', fr: 'French', he: 'Hebrew', diff --git a/electron/main.ts b/electron/main.ts index 9278796..714f93a 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -41,7 +41,7 @@ import * as path from 'path'; // import * as url from 'url'; import l from '../chat/localize'; import {defaultHost, GeneralSettings} from './common'; -import { getSafeLanguages, knownLanguageNames } from './language'; +import { getSafeLanguages, knownLanguageNames, updateSupportedLanguages } from './language'; import * as windowState from './window_state'; import BrowserWindow = Electron.BrowserWindow; import MenuItem = Electron.MenuItem; @@ -271,6 +271,8 @@ function onReady(): void { log.transports.file.file = path.join(baseDir, 'log.txt'); log.info('Starting application.'); + updateSupportedLanguages(electron.session.defaultSession.availableSpellCheckerLanguages); + app.setAppUserModelId('com.squirrel.fchat.F-Chat'); app.on('open-file', createWindow); diff --git a/readme.md b/readme.md index 9172e82..b05f4d3 100644 --- a/readme.md +++ b/readme.md @@ -52,10 +52,10 @@ This repository contains a heavily customized version of the mainline F-Chat 3.0 * Conversation dialog can be opened by typing in a character name * Message search matches character names * PM list shows characters' online status as a colored icon -* Details for Nerds +* Technical Details for Nerds * Upgraded to Electron 8.x - * Replaced node-spellchecker with the built-in spellchecker of Electron 8 - * Multi-language support for spell checking (Windows only – language support is fully automatic on MacOS) + * Replaced `node-spellchecker` with the built-in spellchecker that ships with Electron 8 + * Multi-language support for spell checking (Windows only – language is autodetected on MacOS) ## How to Set Up Ads