Skip to content

Commit

Permalink
Merge branch 'release/v3.10.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
LibelDev committed May 30, 2024
2 parents afd8c88 + bd759bd commit e14dd18
Show file tree
Hide file tree
Showing 84 changed files with 281 additions and 876 deletions.
2 changes: 1 addition & 1 deletion .cz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ commitizen:
name: cz_conventional_commits
tag_format: v$version
update_changelog_on_bump: true
version: 3.9.1
version: 3.10.0
version_files:
- package.json
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ PORT=8080
GOOGLE_ANALYTICS_MEASUREMENT_ID=G-XXXXXXX
GOOGLE_API_KEY=
GOOGLE_CLIENT_ID=
GOOGLE_OAUTH_SCOPES=https://www.googleapis.com/auth/drive.appdata
GOOGLE_GAE_SERVICE_URL=https://your-project-id.region-id.r.appspot.com
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
## v3.10.0 (2024-05-30)

### Feat

- **egg**: adapt LIHKG changes

### Fix

- incorrect URL
- **egg**: eggs not being hatched when back to homepage

### Refactor

- parameter properties
- add ENV `GOOGLE_OAUTH_SCOPES`
- typo
- **mutation**: add `Provider` and `useResponseCache`
- parameter properties
- type only imports and exports

## v3.9.1 (2022-11-17)

### Fix
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 kitce
Copyright (c) 2021 LibelDev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

## Installation / Usage

For the installation steps, usage and more details, please visit [Wiki](https://github.com/kitce/libel/wiki).
For the installation steps, usage and more details, please visit [Wiki](https://github.com/LibelDev/libel/wiki).

關於詳細介紹、安裝教學及使用教學,請閱讀 [Wiki](https://github.com/kitce/libel/wiki)
關於詳細介紹、安裝教學及使用教學,請閱讀 [Wiki](https://github.com/LibelDev/libel/wiki)

***

Expand Down Expand Up @@ -63,19 +63,19 @@ Whenever a file has changed, `webpack-dev-server` will recompile the code, and y
pnpm build
```

The distributable files will be available in [`/dist`](https://github.com/kitce/libel/tree/master/dist)
The distributable files will be available in [`/dist`](https://github.com/LibelDev/libel/tree/master/dist)

***

## Disclaimer

This project only provides technical support for the [features](https://github.com/kitce/libel/wiki#%E5%8A%9F%E8%83%BD). The owner and contributors do not assume any legal responsibilities caused by the users. Users should be aware of and take the risks.
This project only provides technical support for the [features](https://github.com/LibelDev/libel/wiki#%E5%8A%9F%E8%83%BD). The owner and contributors do not assume any legal responsibilities caused by the users. Users should be aware of and take the risks.

***

## Privacy Policy

[Privacy Policy](https://github.com/kitce/libel/wiki/%E7%A7%81%E9%9A%B1%E6%94%BF%E7%AD%96)
[Privacy Policy](https://github.com/LibelDev/libel/wiki/%E7%A7%81%E9%9A%B1%E6%94%BF%E7%AD%96)

***

Expand Down
5 changes: 5 additions & 0 deletions config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ export const publicURL = dev ? `http://localhost:${port}` : homepage;
export const publicDataURL = `${publicURL}/${Directory.Data}`;
export const publicDistURL = dev ? publicURL : `${publicURL}/${Directory.Dist}`;
export const imageProxyURL = dev ? `http://localhost:${port + 1}` : process.env.GOOGLE_GAE_SERVICE_URL;

export const googleAnalyticsMeasurementId = process.env.GOOGLE_ANALYTICS_MEASUREMENT_ID!;
export const googleApiKey = process.env.GOOGLE_API_KEY!;
export const googleClientId = process.env.GOOGLE_CLIENT_ID!;
export const googleOAuthScopes = process.env.GOOGLE_OAUTH_SCOPES?.split(',') || [];
2 changes: 2 additions & 0 deletions config/webpack/plugins/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const {
GOOGLE_ANALYTICS_MEASUREMENT_ID,
GOOGLE_API_KEY,
GOOGLE_CLIENT_ID,
GOOGLE_OAUTH_SCOPES,
GOOGLE_GAE_SERVICE_URL
} = process.env;

Expand All @@ -15,6 +16,7 @@ const plugin = new EnvironmentPlugin({
GOOGLE_ANALYTICS_MEASUREMENT_ID,
GOOGLE_API_KEY,
GOOGLE_CLIENT_ID,
GOOGLE_OAUTH_SCOPES,
GOOGLE_GAE_SERVICE_URL
});

Expand Down
2 changes: 1 addition & 1 deletion data/mock/subscriptions/sample1.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "(Sample) Libel認證【戇鳩】會員名單",
"version": "1.0",
"homepage": "https://github.com/kitce/libel",
"homepage": "https://github.com/LibelDev/libel",
"color": "#fbc308",
"data": {
"35092": [
Expand Down
4 changes: 2 additions & 2 deletions data/mock/subscriptions/sample2.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "Sample 2 (Invalid)",
"version": "1.0",
"homepage": "https://github.com/kitce/libel",
"homepage": "https://github.com/LibelDev/libel",
"data": {
"23094": [
"1": [
{
"text": "",
"url": "`text` cannot be empty"
Expand Down
2 changes: 1 addition & 1 deletion data/mock/subscriptions/sample3.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Sample 3",
"version": "1.0",
"data": {
"23094": [
"1": [
{
"text": "Sample label",
"date": 0
Expand Down
3 changes: 0 additions & 3 deletions dist/egg.js

Large diffs are not rendered by default.

45 changes: 0 additions & 45 deletions dist/egg.js.LICENSE.txt

This file was deleted.

1 change: 0 additions & 1 deletion dist/egg.js.map

This file was deleted.

2 changes: 1 addition & 1 deletion dist/libel.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/libel.meta.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// ==UserScript==
// @name Libel
// @version 3.9.1
// @author kitce <kitce.dev@gmail.com>
// @version 3.10.0
// @author LibelDev <libel.lihkg@gmail.com>
// @description Label users on LIHKG
// @homepage https://kitce.github.io/libel
// @namespace https://github.com/kitce/libel
// @homepage https://LibelDev.github.io/libel
// @namespace https://github.com/LibelDev/libel
// @include https://lihkg.com/*
// @exclude https://lihkg.com/me/*
// @exclude https://lihkg.com/stickers
Expand Down
10 changes: 5 additions & 5 deletions dist/libel.user.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"name": "libel",
"namespace": "libel",
"displayName": "Libel",
"version": "3.9.1",
"version": "3.10.0",
"description": "Label users on LIHKG",
"author": "kitce <kitce.dev@gmail.com>",
"author": "LibelDev <libel.lihkg@gmail.com>",
"repository": {
"type": "git",
"url": "https://github.com/kitce/libel"
"url": "https://github.com/LibelDev/libel"
},
"homepage": "https://kitce.github.io/libel",
"homepage": "https://LibelDev.github.io/libel",
"license": "MIT",
"engines": {
"node": ">=14",
Expand Down
2 changes: 1 addition & 1 deletion src/cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { EventAction, EventCategory } from './types/ga';
const cloud = new Cloud(store, APP_DATA, SYNC_INTERVAL);

cloud.on(SyncEvent.Sync, () => {
const notificationSyncInProgress = LIHKG.createLocalNotification(TEXTS.CLOUD_SYNC_MESSAGE_SYNC_IN_PROGESS, 0);
const notificationSyncInProgress = LIHKG.createLocalNotification(TEXTS.CLOUD_SYNC_MESSAGE_SYNC_IN_PROGRESS, 0);
LIHKG.showNotification(notificationSyncInProgress);
cloud.once(SyncEvent.Finish, () => {
LIHKG.removeNotification(notificationSyncInProgress.id);
Expand Down
2 changes: 1 addition & 1 deletion src/components/AddLabelButton/AddLabelButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import lihkgCssClasses from '../../stylesheets/variables/lihkg/classes.module.sc
import { EventAction, EventCategory, EventLabel } from '../../types/ga';
import IconButton from '../IconButton/IconButton';
import useLabelForm from '../LabelForm/useLabelForm';
import LabelFormModal, { TLabelFormProps } from '../LabelFormModal/LabelFormModal';
import LabelFormModal, { type TLabelFormProps } from '../LabelFormModal/LabelFormModal';
import styles from './AddLabelButton.module.scss';

interface IProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/BaseIconButton/BaseIconButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames';
import type React from 'react';
import Button, { TProps as TButtonProps } from '../Button/Button';
import Button, { type TProps as TButtonProps } from '../Button/Button';
import Icon from '../Icon/Icon';
import type { IconName } from '../Icon/types';
import styles from './BaseIconButton.module.scss';
Expand Down
12 changes: 7 additions & 5 deletions src/components/BlockquoteMessageInfo/BlockquoteMessageInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import classNames from 'classnames';
import { format } from 'date-fns';
import React from 'react';
import { DISPLAY_DATE_FORMAT } from '../../constants/label';
import useResponseCache from '../../hooks/useResponseCache';
import type { IPost } from '../../types/lihkg';
import Icon from '../Icon/Icon';
import { IconName } from '../Icon/types';
Expand All @@ -14,7 +15,6 @@ import styles from './BlockquoteMessageInfo.module.scss';
interface IProps {
post: IPost;
inline?: boolean;
highlight?: boolean;
}

/**
Expand All @@ -28,27 +28,29 @@ type TComponentProps = TComponentPropsWithoutRef<'small', IProps>;
type TProps = IProps & TComponentProps;

const BlockquoteMessageInfo: React.FunctionComponent<TProps> = (props) => {
const { className, post, inline, highlight, ...otherProps } = props;
const { className, post, inline, ...otherProps } = props;

const { user } = post;
const date = format(post.reply_time * 1000, DISPLAY_DATE_FORMAT);

const cache = useResponseCache();
const poster = cache?.getCurrentThreadPoster();

return (
<small
className={
classNames(
className,
styles.blockquoteMessageInfo,
{
[styles.highlight]: highlight
[styles.highlight]: poster?.user_id === post.user.user_id
}
)
}
{...otherProps}
>
<Icon className={styles.icon} icon={IconName.FormatQuoteClose} />
<span className={styles.messageNumber}>#{post.msg_num}</span>
<Username user={user} />
<Username user={post.user} />
<span className={styles.date}>{date}</span>
</small>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import BaseButton, { TProps } from '../BaseButton/BaseButton';
import BaseButton, { type TProps } from '../BaseButton/BaseButton';

export default BaseButton;

export { TProps };
export { type TProps };
2 changes: 1 addition & 1 deletion src/components/ColorPicker/ColorPicker.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames';
import type React from 'react';
import BaseInput, { TProps as TBaseInputProps } from '../BaseInput/BaseInput';
import BaseInput, { type TProps as TBaseInputProps } from '../BaseInput/BaseInput';
import styles from './ColorPicker.module.scss';

interface IProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/DataSetEditor/Filter/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useCallback } from 'react';
import { Key } from 'ts-key-enum';
import useFocus from '../../../hooks/useFocus';
import { IconName } from '../../Icon/types';
import TextInput, { TProps as TTextInputProps } from '../../TextInput/TextInput';
import TextInput, { type TProps as TTextInputProps } from '../../TextInput/TextInput';

export interface IProps {
onChange: (keyword: string) => void;
Expand Down
2 changes: 1 addition & 1 deletion src/components/DataSetEditorModal/DataSetEditorModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useId } from 'react';
import * as TEXTS from '../../constants/texts';
import Button from '../Button/Button';
import DataSetEditor, { IProps as IDataSetEditorProps, TProps as TDataSetEditorProps } from '../DataSetEditor/DataSetEditor';
import Modal, { TProps as TModalProps } from '../Modal/Modal';
import Modal, { type TProps as TModalProps } from '../Modal/Modal';
import styles from './DataSetEditorModal.module.scss';

interface IProps { }
Expand Down
2 changes: 1 addition & 1 deletion src/components/EditLabelButton/EditLabelButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { EventAction, EventCategory, EventLabel } from '../../types/ga';
import { IconName } from '../Icon/types';
import IconButton from '../IconButton/IconButton';
import useLabelForm from '../LabelForm/useLabelForm';
import LabelFormModal, { TLabelFormProps } from '../LabelFormModal/LabelFormModal';
import LabelFormModal, { type TLabelFormProps } from '../LabelFormModal/LabelFormModal';

interface IProps {
user: string;
Expand Down
2 changes: 1 addition & 1 deletion src/components/EmoticonTranslator/EmoticonTranslator.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { escape } from '../../helpers/regex';
import { useEmoticonMap } from '../../hooks/useEmoticon';
import Emoticon, { TProps as TEmoticonProps } from '../Emoticon/Emoticon';
import Emoticon, { type TProps as TEmoticonProps } from '../Emoticon/Emoticon';
import { withTraverse } from '../Traverse/Traverse';

/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/IconButton/IconButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import BaseIconButton, { TProps } from '../BaseIconButton/BaseIconButton';
import BaseIconButton, { type TProps } from '../BaseIconButton/BaseIconButton';

export default BaseIconButton;

export { TProps };
export { type TProps };
2 changes: 1 addition & 1 deletion src/components/IconLink/IconLink.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type React from 'react';
import IconButton, { TProps as TIconButtonProps } from '../IconButton/IconButton';
import IconButton, { type TProps as TIconButtonProps } from '../IconButton/IconButton';

interface IProps { }

Expand Down
6 changes: 3 additions & 3 deletions src/components/LabelForm/LabelForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import joi from 'joi';
import type React from 'react';
import { useCallback, useEffect, useId, useMemo, useState } from 'react';
import { namespace } from '../../../package.json';
import cache from '../../cache';
import * as TEXTS from '../../constants/texts';
import * as gtag from '../../helpers/gtag';
import * as LIHKG from '../../helpers/lihkg';
import { mapValidationError } from '../../helpers/validation';
import useLabelSourcePost from '../../hooks/useLabelSourcePost';
import useResponseCache from '../../hooks/useResponseCache';
import useSourcePostScreenshot from '../../hooks/useSourcePostScreenshot';
import type { ILabel } from '../../models/Label';
import { color, image, reason, text } from '../../schemas/label';
Expand Down Expand Up @@ -86,7 +86,7 @@ const LabelForm: React.FunctionComponent<TProps> = (props) => {
const [isColorEnabled, setIsColorEnabled] = useState(!!formData.color);
const [isScreenshotEnabled, setIsScreenshotEnabled] = useState(false);
const [inputErrors, setInputErrors] = useState<IInputErrors>({});

const cache = useResponseCache();
const post = useLabelSourcePost();
const [screenshot, capture] = useSourcePostScreenshot(post);

Expand All @@ -98,7 +98,7 @@ const LabelForm: React.FunctionComponent<TProps> = (props) => {
const _errorId = `${_id}-error`;
const name = `${namespace}-${LabelForm.displayName!}`;

const _user = cache.getUser(user);
const _user = cache?.getUser(user);

const handleInputChange: React.ChangeEventHandler<HTMLInputElement> = useCallback((event) => {
const { name, value } = event.target;
Expand Down
Loading

0 comments on commit e14dd18

Please sign in to comment.