Remove feedback

This commit is contained in:
Pig Fang 2019-03-12 20:51:46 +08:00
parent 9d890648e4
commit 69b6d3685d
10 changed files with 0 additions and 96 deletions

View File

@ -201,8 +201,6 @@ class AdminController extends Controller
$form->text('texture_name_regexp')->hint()->placeholder();
$form->textarea('comment_script')->rows(6)->description();
$form->checkbox('allow_sending_statistics')->label()->hint();
})->handle(function () {
Option::set('site_name_'.config('app.locale'), request('site_name'));
Option::set('site_description_'.config('app.locale'), request('site_description'));

View File

@ -20,7 +20,6 @@ return [
'player_name_length_min' => '3',
'player_name_length_max' => '16',
'comment_script' => '',
'allow_sending_statistics' => 'true',
'user_initial_score' => '1000',
'sign_gap_time' => '24',
'sign_score' => '10,100',

View File

@ -1,34 +0,0 @@
import { queryStringify } from './utils';
export async function sendFeedback() {
if (document.cookie.replace(/(?:(?:^|.*;\s*)feedback_sent\s*=\s*([^;]*).*$)|^.*$/, '$1')) {
return;
}
const response = await fetch('https://work.prinzeugen.net/statistics/feedback', {
body: queryStringify({
site_name: blessing.site_name,
site_url: blessing.base_url,
version: blessing.version
}),
headers: {
Accept: 'application/json',
'Content-Type': 'application/x-www-form-urlencoded'
},
method: 'POST',
mode: 'cors'
});
if (response.ok) {
const { errno } = await response.json();
if (errno === 0) {
// It will be expired when current session ends
document.cookie = 'feedback_sent=' + Date.now();
console.info('Feedback sent. Thank you!');
}
}
}
window.sendFeedback = sendFeedback;

View File

@ -5,7 +5,6 @@ import './event';
import './layout';
import './logout';
import './check-updates';
import './feedback';
console.log(
`%c Blessing Skin %c v${blessing.version} %c Made with %c<3%c by printempw.%c https://blessing.studio`,

View File

@ -1,16 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`send feedback 1`] = `
Array [
"https://work.prinzeugen.net/statistics/feedback",
Object {
"body": "site_name=Blessing%20Skin&site_url=&version=4.0.0",
"headers": Object {
"Accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded",
},
"method": "POST",
"mode": "cors",
},
]
`;

View File

@ -1,28 +0,0 @@
import { sendFeedback } from '@/js/feedback';
test('send feedback', async () => {
window.fetch = jest.fn()
.mockResolvedValueOnce({ ok: false })
.mockResolvedValueOnce({
ok: true,
json: () => Promise.resolve({ errno: 1 })
})
.mockResolvedValue({
ok: true,
json: () => Promise.resolve({ errno: 0 })
});
await sendFeedback();
expect(document.cookie).toBe('');
expect(fetch.mock.calls[0]).toMatchSnapshot();
await sendFeedback();
expect(document.cookie).toBe('');
await sendFeedback();
expect(document.cookie).toStartWith('feedback_sent=');
window.fetch.mockClear();
await sendFeedback();
expect(window.fetch).not.toBeCalled();
});

View File

@ -117,10 +117,6 @@ general:
comment_script:
title: Comment Script
description: Placeholder is available, <code>{tid}</code> will be replaced with texture id, <code>{name}</code> will be replaced with texture name, <code>{url}</code> will be replaced with current URL.
allow_sending_statistics:
title: Statistics
label: Send usage statistics anonymously.
hint: Privacy information will nerver be sent.
announ:
title: Announcement

View File

@ -117,10 +117,6 @@ general:
comment_script:
title: 评论代码
description: 评论代码内可使用占位符,<code>{tid}</code> 将会被自动替换为材质的 id<code>{name}</code> 会被替换为材质名称,<code>{url}</code> 会被替换为当前页面地址。
allow_sending_statistics:
title: 统计信息
label: 发送程序使用情况统计信息以帮助开发
hint: 隐私信息不会被收集
announ:
title: 站点公告

View File

@ -102,10 +102,6 @@
});
</script>
@if (option('allow_sending_statistics'))
<script>sendFeedback();</script>
@endif
@yield('script')
</body>
</html>

View File

@ -110,7 +110,6 @@ class AdminControllerTest extends BrowserKitTestCase
->select('1', 'api_type')
->check('auto_del_invalid_texture')
->type('code', 'comment_script')
->uncheck('allow_sending_statistics')
->press('submit_general');
$this->assertEquals('My Site', option_localized('site_name'));
$this->assertEquals('hi', option_localized('site_description'));
@ -124,7 +123,6 @@ class AdminControllerTest extends BrowserKitTestCase
$this->assertEquals('1', option('api_type'));
$this->assertTrue(option('auto_del_invalid_texture'));
$this->assertEquals('code', option('comment_script'));
$this->assertFalse(option('allow_sending_statistics'));
$this->visit('/admin/options')
->type('http://blessing.skin/index.php', 'site_url')