Skip to content

Commit

Permalink
Various minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 20, 2019
1 parent 2717359 commit 8ef4f30
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 97 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.md
59 changes: 35 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@
"p-wait-for": "^2.0.1"
},
"devDependencies": {
"@sindresorhus/tsconfig": "^0.2.0",
"@sindresorhus/tsconfig": "^0.2.1",
"@types/electron-is-dev": "^0.3.0",
"@types/electron-store": "^1.3.0",
"@types/element-ready": "^2.1.0",
"@types/lodash": "^4.14.120",
"@typescript-eslint/eslint-plugin": "^1.1.1",
"@typescript-eslint/eslint-plugin": "^1.4.0",
"del-cli": "^1.1.0",
"electron": "^4.0.4",
"electron": "^4.0.5",
"electron-builder": "^20.38.5",
"eslint-config-xo-typescript": "^0.6.0",
"eslint-config-xo-typescript": "^0.8.0",
"husky": "^1.3.1",
"np": "^4.0.2",
"stylelint": "^9.10.1",
"stylelint-config-xo": "^0.12.0",
"typescript": "^3.2.4",
"stylelint-config-xo": "^0.13.0",
"typescript": "^3.3.3",
"xo": "^0.24.0"
},
"xo": {
Expand All @@ -68,8 +68,6 @@
"browser"
],
"rules": {
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/member-delimiter-style": "off",
"valid-jsdoc": "off"
},
"prettier": true
Expand Down
14 changes: 5 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ Caprine is an unofficial and privacy-focused Facebook Messenger app with many us
<img src="https://c5.patreon.com/external/logo/[email protected]" width="160">
</a>


## Highlights

- [Dark theme](#dark-mode)
- [Vibrant theme](#vibrancy)*
- [Privacy-focused](#hide-last-seen--typing-indicator)
- [Vibrant theme](#vibrancy)\*
- [Privacy-focused](#privacy)
- [Keyboard shortcuts](#keyboard-shortcuts)
- [Work Chat support](#work-chat-support)
- [Code blocks](#code-blocks)
Expand All @@ -30,6 +29,7 @@ Caprine is an unofficial and privacy-focused Facebook Messenger app with many us
- Cross-platform
- Silent auto-updates
- Custom text size
- Emoji style setting

\*macOS only

Expand Down Expand Up @@ -76,11 +76,11 @@ On *macOS*, you can toggle the window vibrancy effect in the `View` menu.

<img src="media/screenshot-vibrancy.jpg" width="1165">

### Hide last seen / typing indicator
### Privacy

<img src="media/screenshot-block-typing-indicator.png" width="626">

You can choose to prevent people from knowing when you've seen a message or are currently typing. Both options are available under the `Caprine`/`File` menu.
You can choose to prevent people from knowing when you have seen a message and when you are currently typing. These settings are available under the `Caprine`/`File` menu.

### Mute desktop notifications

Expand Down Expand Up @@ -195,24 +195,20 @@ $ npm run release

Then edit the automatically created GitHub Releases draft and publish.


## Maintainers

- [Sindre Sorhus](https://sindresorhus.com)
- [Aw Young Qingzhuo](https://github.com/veniversum)
- [Jarek Radosz](https://github.com/CvX)


## Links

- [Product Hunt post](https://www.producthunt.com/posts/caprine-2)


## Disclaimer

Caprine is a third-party app and is not affiliated with Facebook.


## License

MIT
8 changes: 4 additions & 4 deletions source/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ async function sendConversationList(): Promise<void> {
if (groupPic) {
// Slice image source from background-image style property of div
const bgImage = groupPic.style.backgroundImage!;
groupPic.src = bgImage!.slice(5, bgImage.length - 2);
groupPic.src = bgImage.slice(5, bgImage.length - 2);
}

const isConversationMuted = el.classList.contains('_569x');
Expand All @@ -439,7 +439,7 @@ async function sendConversationList(): Promise<void> {
selected: el.classList.contains('_1ht2'),
unread: el.classList.contains('_1ht3') && !isConversationMuted,
icon: await getDataUrlFromImg(
profilePic ? profilePic! : groupPic!,
profilePic ? profilePic : groupPic!,
el.classList.contains('_1ht3')
)
};
Expand All @@ -450,7 +450,7 @@ async function sendConversationList(): Promise<void> {
}

// Return canvas with rounded image
function urlToCanvas(url: string, size: number): Promise<HTMLCanvasElement> {
async function urlToCanvas(url: string, size: number): Promise<HTMLCanvasElement> {
return new Promise(resolve => {
const img = new Image();
img.crossOrigin = 'anonymous';
Expand Down Expand Up @@ -483,7 +483,7 @@ function urlToCanvas(url: string, size: number): Promise<HTMLCanvasElement> {
}

// Return data url for user avatar
function getDataUrlFromImg(img: HTMLImageElement, unread: boolean): Promise<string> {
async function getDataUrlFromImg(img: HTMLImageElement, unread: boolean): Promise<string> {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async resolve => {
if (unread) {
Expand Down
6 changes: 3 additions & 3 deletions source/emoji.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ function codeForEmojiStyle(style: EmojiStyle): EmojiStyleCode {
* Renders the given emoji in the renderer process and returns a Promise for a PNG `data:` URL
*/
const renderEmoji = memoize(
(emoji: string): Promise<string> =>
async (emoji: string): Promise<string> =>
new Promise(resolve => {
const listener = (_event: ElectronEvent, arg: {emoji: string; dataUrl: string}): void => {
if (arg.emoji !== emoji) {
Expand All @@ -250,7 +250,7 @@ const renderEmoji = memoize(
);

/**
* @param url A Facebook emoji URL like https://static.xx.fbcdn.net/images/emoji.php/v9/tae/2/16/1f471_1f3fb_200d_2640.png
* @param url - A Facebook emoji URL like https://static.xx.fbcdn.net/images/emoji.php/v9/tae/2/16/1f471_1f3fb_200d_2640.png
*/
function urlToEmoji(url: string): string {
const codePoints = url
Expand All @@ -275,7 +275,7 @@ function urlToEmoji(url: string): string {
const cachedEmojiMenuIcons = new Map<EmojiStyle, NativeImage>();

/**
* @return An icon to use for the menu item of this emoji style
* @return An icon to use for the menu item of this emoji style.
*/
async function getEmojiIcon(style: EmojiStyle): Promise<NativeImage | undefined> {
const cachedIcon = cachedEmojiMenuIcons.get(style);
Expand Down
5 changes: 4 additions & 1 deletion source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ if (!isDev) {
autoUpdater.logger = log;

const FOUR_HOURS = 1000 * 60 * 60 * 4;
setInterval(() => autoUpdater.checkForUpdates(), FOUR_HOURS);
setInterval(() => {
autoUpdater.checkForUpdates();
}, FOUR_HOURS);

autoUpdater.checkForUpdates();
}

Expand Down
Loading

0 comments on commit 8ef4f30

Please sign in to comment.