well done

This commit is contained in:
syuilo 2017-02-22 04:19:53 +09:00
parent 7203c176e8
commit 9820a691c1
12 changed files with 58 additions and 8 deletions

View file

@ -31,8 +31,7 @@ and more! You can touch with your own eyes at https://misskey.xyz/.
2. `git clone git://github.com/syuilo/misskey.git`
3. `cd misskey`
4. `npm install`
5. `npm run config`
6. `npm run build`
5. `npm run build`
GLHF!
@ -92,6 +91,7 @@ If you want to run misskey in production mode, add `--env NODE_ENV=production` l
Note that `$(pwd)` is the working directory.
## Launch
(初回起動時はまず `npm run config` してください)
`sudo npm start`
## Debugging :bug:

View file

@ -17,11 +17,13 @@ require('./common/tags');
"use strict";
const CONFIG = require('./common/scripts/config');
document.domain = CONFIG.host;
// Set global configration
riot.mixin({
CONFIG: CONFIG
CONFIG
});
// ↓ iOS待ちPolyfill (SEE: http://caniuse.com/#feat=fetch)

View file

@ -2,6 +2,8 @@
* API Request
*/
const CONFIG = require('./config');
let spinner = null;
let pending = 0;

View file

@ -0,0 +1,18 @@
const url = new URL(location.href);
const isRoot = url.host.split('.')[0] == 'misskey';
const host = isRoot ? url.host : url.host.substring(url.host.indexOf('.') + 1, url.host.length);
const scheme = url.protocol;
const apiUrl = `${scheme}//api.${host}`;
const devUrl = `${scheme}//dev.${host}`;
const aboutUrl = `${scheme}//about.${host}`;
module.exports = {
host,
scheme,
apiUrl,
devUrl,
aboutUrl,
themeColor: '#f76d6c'
};

View file

@ -1,5 +1,6 @@
const ReconnectingWebSocket = require('reconnecting-websocket');
const riot = require('riot');
const CONFIG = require('./config');
class Connection {
constructor(me, otherparty) {

View file

@ -1,3 +1,5 @@
const CONFIG = require('./config');
module.exports = () => {
localStorage.removeItem('me');
document.cookie = `i=; domain=.${CONFIG.host}; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;

View file

@ -1,5 +1,6 @@
const ReconnectingWebSocket = require('reconnecting-websocket');
const riot = require('riot');
const CONFIG = require('./config');
module.exports = me => {
let state = 'initializing';

View file

@ -1,5 +1,6 @@
const riot = require('riot');
const nyaize = require('nyaize').default;
const CONFIG = require('./config');
const escape = function(text) {
return text

View file

@ -30,7 +30,7 @@
</label>
<label class="recaptcha">
<p class="caption"><i class="fa fa-toggle-on" if={ recaptchaed }></i><i class="fa fa-toggle-off" if={ !recaptchaed }></i>認証</p>
<div class="g-recaptcha" data-callback="onRecaptchaed" data-expired-callback="onRecaptchaExpired" data-sitekey={ CONFIG.recaptcha.siteKey }></div>
<div if={ recaptcha } class="g-recaptcha" data-callback="onRecaptchaed" data-expired-callback="onRecaptchaExpired" data-sitekey={ recaptcha.siteKey }></div>
</label>
<label class="agree-tou">
<input name="agree-tou" type="checkbox" autocomplete="off" required="required"/>
@ -193,10 +193,20 @@
};
this.on('mount', () => {
const head = document.getElementsByTagName('head')[0];
const script = document.createElement('script');
script.setAttribute('src', 'https://www.google.com/recaptcha/api.js');
head.appendChild(script);
fetch('/config.json').then(res => {
res.json().then(conf => {
this.update({
recaptcha: {
siteKey: conf.recaptcha.siteKey
}
});
const head = document.getElementsByTagName('head')[0];
const script = document.createElement('script');
script.setAttribute('src', 'https://www.google.com/recaptcha/api.js');
head.appendChild(script);
});
});
});
this.onChangeUsername = () => {

View file

@ -1,4 +1,5 @@
const riot = require('riot');
const CONFIG = require('../../common/scripts/config');
const dialog = require('./dialog');
const api = require('../../common/scripts/api');

View file

@ -1,4 +1,5 @@
const riot = require('riot');
const CONFIG = require('../../common/scripts/config');
const dialog = require('./dialog');
const api = require('../../common/scripts/api');

View file

@ -51,6 +51,17 @@ app.get(/\/api:meta/, require('./meta'));
app.get(/\/api:url/, require('./service/url-preview'));
app.post(/\/api:rss/, require('./service/rss-proxy'));
/**
* Serve config
*/
app.get('/config.json', (req, res) => {
res.send({
recaptcha: {
siteKey: config.recaptcha.siteKey
}
});
});
/**
* Subdomain
*/