text:
var fs = require('fs'),
    path = require('path'),
    https = require('https'),
    crypto = require('crypto'),
    expect = require('chai').expect,
    txf = require('..');

function _got(method, ...args) {
    let gp;
    const p = new Promise((resolve, reject) => {
        import('got').then(got => {
            resolve(gp = got.default[method](...args));
        }).catch(reject);
    });
    p.json = () => gp.json();
    p.buffer = () => gp.buffer();
    return p;
}

function get(...args) {
    return _got('get', ...args);
}

function put(...args) {
    return _got('put', ...args);
}

function head(...args) {
    return _got('head', ...args);
}

var port = 8700;

var secrets = {
    foo: {
        sender: '',
        receiver: ''
    },
    prot: {
        sender: 'foobar',
        receiver: 'fred bloggs'
    },
    no_keys: {}
};

function make_server(protocol, cb)
{
    var opts;
    if (protocol === 'https')
    {
        opts = {
            key: fs.readFileSync(path.join(__dirname, 'server.key')),
            cert: fs.readFileSync(path.join(__dirname, 'server.pem'))
        };
    }
    var server = require(protocol).createServer(opts);
    server.listen(port, cb);
    return server;
}

function stest(protocol, options)
{
    var url = protocol + '://localhost:' + port + '/';
describe(protocol, async function ()
{

describe('txf', function ()
{
    var server, senders_and_receivers;

    before(function (cb)
    {
        server = make_server(protocol, cb);
        senders_and_receivers = txf(server, secrets);
    });

    after(function (cb)
    {
        server.close(function (err)
        {
            expect(senders_and_receivers.senders.size === 0);
            expect(senders_and_receivers.receivers.size === 0);
            cb(err);
        });
    });

    function test(description, make_put_url, make_get_url)
    {
    describe(description, function ()
    {
        it('should transfer data', async function ()
        {
            const getP = get(make_get_url('bar'), options);
            const putP = put(make_put_url('bar'), {
                ...options,
                json: 'hello'
            });

            const get_response = await getP;
            expect(get_response.statusCode).equal(200);
            expect(get_response.headers['content-type']).to.equal('application/json');
            expect(await getP.json()).to.equal('hello');

            const put_response = await putP;
            expect(put_response.statusCode).to.equal(200);
        });

        it('should support multiple transfers at the same time', async function ()
        {
            this.timeout(60 * 1000);

            for (let i = 0; i < 100; i += 1)
            {
                const getP = get(make_get_url('bar' + i), options);
                const putP = put(make_put_url('bar' + i), {
                    ...options,
                    json: {
                        foo: 'hello',
                        num: i,
                    }
                });

                const get_response = await getP;
                expect(get_response.statusCode).to.equal(200);
                expect(await getP.json()).to.deep.equal({
                    foo: 'hello',
                    num: i
                });

                const put_response = await putP;
                expect(put_response.statusCode).to.equal(200);
            }
        });

        it('should error if get request is in progress', async function ()
        {
            const getP = get(make_get_url('bar'), options);

            expect((await get(make_get_url('bar'), {
                ...options,
                throwHttpErrors: false
            })).statusCode).to.equal(409);

            const putP = put(make_put_url('bar'), {
                ...options,
                json: 'hello'
            });

            const get_response = await getP;
            expect(get_response.statusCode).to.equal(200);
            expect(await getP.json()).to.equal('hello');

            const put_response = await putP;
            expect(put_response.statusCode).to.equal(200);
        });

        it('should error if put request is in progress', async function ()
        {
            const putP = put(make_put_url('bar'), {
                ...options,
                json: 'hello'
            });

            expect((await put(make_put_url('bar'), {
                ...options,
                json: 'hello',
                throwHttpErrors: false
            })).statusCode).to.equal(409);

            const getP = get(make_get_url('bar'), options);
            const get_response = await getP;
            expect(get_response.statusCode).to.equal(200);
            expect(await getP.json()).to.equal('hello');

            const put_response = await putP;
            expect(put_response.statusCode).to.equal(200);
        });

        it('should support large transfers', async function ()
        {
            const buf = crypto.randomBytes(1024 * 1024);

            const putP = put(make_put_url('bar'), {
                ...options,
                body: buf
            });

            const getP = get(make_get_url('bar'), options);
            const get_response = await getP;
            expect(get_response.statusCode).equal(200);
            expect(get_response.headers['content-type']).to.equal('application/octet-stream');
            expect((await getP.buffer()).equals(buf)).to.equal(true);

            const put_response = await putP;
            expect(put_response.statusCode).to.equal(200);
        });

        it('should error if too many levels in path', async function ()
        {
            expect((await get(make_get_url('bar/dummy1/dummy2'), {
                ...options,
                throwHttpErrors: false
            })).statusCode).to.equal(400);
        });

        it('should error if namespace unknown', async function ()
        {
            expect((await get(make_get_url('bar', 'dummy'), {
                ...options,
                throwHttpErrors: false
            })).statusCode).to.equal(403);
        });

        if (description === 'auth')
        {
            it('should error if receiver digest is wrong', async function ()
            {
                expect((await get(make_put_url('bar'), {
                    ...options,
                    throwHttpErrors: false
                })).statusCode).to.equal(404);
            });

            it('should error if sender digest is wrong', async function ()
            {
                expect((await put(make_get_url('bar'), {
                    ...options,
                    json: 'hello',
                    throwHttpErrors: false
                })).statusCode).to.equal(404);
            });
        }

        it('should error if namespace has no receiver key', async function ()
        {
            expect((await get(make_get_url('bar', 'no_keys'), {
                ...options,
                throwHttpErrors: false
            })).statusCode).to.equal(403);
        });

        it('should error if namespace has no sender key', async function ()
        {
            expect((await put(make_put_url('bar', 'no_keys'), {
                ...options,
                json: 'hello',
                throwHttpErrors: false
            })).statusCode).to.equal(403);
        });

        it('should error if request is not put or get', async function ()
        {
            expect((await head(make_get_url('bar'), {
                ...options,
                throwHttpErrors: false
            })).statusCode).to.equal(405);
        });

        it('should cope with close and end events occurring on request', async function ()
        {
            server.on('request', function (request, response)
            {
                request.on('end', function ()
                {
                    this.emit('close');
                });

                response.on('finish', function ()
                {
                    this.emit('close');
                });
            });

            const getP = get(make_get_url('bar'), options);
            const putP = put(make_put_url('bar'), {
                ...options,
                json: 'hello'
            });

            const get_response = await getP;
            expect(get_response.statusCode).equal(200);
            expect(await getP.json()).to.equal('hello');

            const put_response = await putP;
            expect(put_response.statusCode).to.equal(200);
        });

        it('should pass on content-type', async function ()
        {
            const buf = crypto.randomBytes(1024);

            const putP = put(make_put_url('bar'), {
                ...options,
                body: buf,
                headers: {
                    'Content-Type': 'dummy1/dummy2'
                }
            });

            const getP = get(make_get_url('bar'), options);
            const get_response = await getP;
            expect(get_response.statusCode).equal(200);
            expect(get_response.headers['content-type']).to.equal('dummy1/dummy2');
            expect((await getP.buffer()).equals(buf)).to.equal(true);

            const put_response = await putP;
            expect(put_response.statusCode).to.equal(200);
        });
    });
    }

    function make_url_no_auth(path, namespace)
    {
        return url + (namespace || 'foo') + '/' + path;
    }

    test('no auth', make_url_no_auth, make_url_no_auth);

    test('auth', function (path, namespace)
    {
        return url +
               (namespace || 'prot') + '/' +
               crypto.createHmac('sha256', secrets.prot.sender)
                   .update(path)
                   .digest('hex') + '/' +
               path;
    }, function (path, namespace)
    {
        return url +
               (namespace || 'prot') + '/' +
               crypto.createHmac('sha256', secrets.prot.receiver)
                   .update(path)
                   .digest('hex') + '/' +
               path;
    });
});

describe('txf-no-secerts', function ()
{
    var server;

    before(function (cb)
    {
        server = make_server(protocol, cb);
        txf(server);
    });

    after(function (cb)
    {
        server.close(cb);
    });

    it('should error when no secrets have been supplied', async function ()
    {
        expect((await get(url + 'foo/bar', {
            ...options,
            throwHttpErrors: false
        })).statusCode).to.equal(403);
    });
});

});
}

stest('http');
stest('https', ({
    https: {
        certificateAuthority: fs.readFileSync(path.join(__dirname, 'ca.pem'))
    }
}));


text:
搜索商品

添加商品

redpajama_set_name: RedPajamaGithub


text:
import {CoreStore} from 'focus-core/store';

/**
* Store dealing with subjects about movies.
* @type {focus}
*/
const processDefinitionStore = new CoreStore({
    definition: {
        processCaracteristics: 'processCaracteristics'
    }
});

export default processDefinitionStore;


text:
{% extends '../_base.html' %}

{% block pagehead %}

{% endblock %}

{% block title %} {{ _('change password')}} {% endblock %}
{% block jump-title  %}密码修改成功{% endblock %}

{% block content %}

{{ _('change password') }}

		<form v-on:submit.prevent="submit" class="uk-form uk-form-stacked">
			<fieldset>

			        {{ _('old password') }}

			        	<input v-model="oldpassword" name="oldpassword"  type="password" class="uk-width-1-1">

			        {{ _('new password') }}

			        	<input v-model="newpassword" name="newpassword" type="password" class="uk-width-1-1">

6-20位,允许小写字母、大写字母和数字

			        {{ _('verify password') }}

			        	<input v-model="verifypassword" name="verifypassword" type="password" class="uk-width-1-1">

6-20位,允许小写字母、大写字母和数字

			        	<button  type="submit" class="uk-button-primary uk-button-large uk-width-1-1"> {{ _('Change') }}</button>

	    </fieldset>
		</form>

{% endblock %}


text:
Name
 <input type="text" name="attr_character_name" />

Description
 <input type="text" name="attr_short_description" />

Distinctions

			<input type="text" name="attr_Distinction1" />+PP

			<input type="text" name="attr_Distinction2" />+PP

			<input type="text" name="attr_Distinction3" />+PP

Attributes

Agility

<input type="radio" name="attr_Agility" value="d4">

<input type="radio" name="attr_Agility" value="d6">

<input type="radio" name="attr_Agility" value="d8">

<input type="radio" name="attr_Agility" value="d10">

<input type="radio" name="attr_Agility" value="d12" disabled>

			Alertness

<input type="radio" name="attr_Alertness" value="d4">

<input type="radio" name="attr_Alertness" value="d6">

<input type="radio" name="attr_Alertness" value="d8">

<input type="radio" name="attr_Alertness" value="d10">

<input type="radio" name="attr_Alertness" value="d12" disabled>

			Intelligence

<input type="radio" name="attr_Intelligence" value="d4">

<input type="radio" name="attr_Intelligence" value="d6">

<input type="radio" name="attr_Intelligence" value="d8">

<input type="radio" name="attr_Intelligence" value="d10">

<input type="radio" name="attr_Intelligence" value="d12" disabled>

			Strength

<input type="radio" name="attr_Strength" value="d4">

<input type="radio" name="attr_Strength" value="d6">

<input type="radio" name="attr_Strength" value="d8">

<input type="radio" name="attr_Strength" value="d10">

<input type="radio" name="attr_Strength" value="d12" disabled>

			Vitality

<input type="radio" name="attr_Vitality" value="d4">

<input type="radio" name="attr_Vitality" value="d6">

<input type="radio" name="attr_Vitality" value="d8">

<input type="radio" name="attr_Vitality" value="d10">

<input type="radio" name="attr_Vitality" value="d12" disabled>

			Willpower

<input type="radio" name="attr_Willpower" value="d4">

<input type="radio" name="attr_Willpower" value="d6">

<input type="radio" name="attr_Willpower" value="d8">

<input type="radio" name="attr_Willpower" value="d10">

<input type="radio" name="attr_Willpower" value="d12" disabled>

Roles

			Grifter

<input type="radio" name="attr_Grifter" value="d4">

<input type="radio" name="attr_Grifter" value="d6">

<input type="radio" name="attr_Grifter" value="d8">

<input type="radio" name="attr_Grifter" value="d10">

<input type="radio" name="attr_Grifter" value="d12" disabled>

		<fieldset class="repeating_GrifterSpecialty">

			<input type="text" name="attr_GrifterSpec" />

		</fieldset>

			Hacker

<input type="radio" name="attr_Hacker" value="d4">

<input type="radio" name="attr_Hacker" value="d6">

<input type="radio" name="attr_Hacker" value="d8">

<input type="radio" name="attr_Hacker" value="d10">

<input type="radio" name="attr_Hacker" value="d12" disabled>

		<fieldset class="repeating_HackerSpecialty">

			<input type="text" name="attr_HackerSpec" />

		</fieldset>

			Hitter

<input type="radio" name="attr_Hitter" value="d4">

<input type="radio" name="attr_Hitter" value="d6">

<input type="radio" name="attr_Hitter" value="d8">

<input type="radio" name="attr_Hitter" value="d10">

<input type="radio" name="attr_Hitter" value="d12" disabled>

		<fieldset class="repeating_HitterSpecialty">

		<input type="text" name="attr_HitterSpec" />

		</fieldset>

			Mastermind

<input type="radio" name="attr_Mastermind" value="d4">

<input type="radio" name="attr_Mastermind" value="d6">

<input type="radio" name="attr_Mastermind" value="d8">

<input type="radio" name="attr_Mastermind" value="d10">

<input type="radio" name="attr_Mastermind" value="d12" disabled>

		<fieldset class="repeating_MastermindSpecialty">

		<input type="text" name="attr_MastermindSpec" />

		</fieldset>

			Thief

<input type="radio" name="attr_Thief" value="d4">

<input type="radio" name="attr_Thief" value="d6">

<input type="radio" name="attr_Thief" value="d8">

<input type="radio" name="attr_Thief" value="d10">

<input type="radio" name="attr_Thief" value="d12" disabled>

		<fieldset class="repeating_TheifSpecialty">

		<input type="text" name="attr_ThiefSpec" />

		</fieldset>

Talents

		<fieldset class="repeating_Talent">

				<input type="text" name="attr_Talent1Name" />

				<textarea name="attr_Talent1Description" rows="8" data-width="270px" style="width: 270px;"></textarea>

		</fieldset>

Assets

			<input type="text" name="attr_PrimaryAsset" />

		<fieldset class="repeating_assets">

			<input type="text" name="attr_OtherAsset" />

		</fieldset>